> On June 5, 2013, 3:13 a.m., Ben Mahler wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/bandwidth.hpp, line 10 > > <https://reviews.apache.org/r/11542/diff/2/?file=299690#file299690line10> > > > > I'm not sure what you mean by "an event is fired" in your second point? > > > > The main hesitation is that if anyone wants to use this nice Bandwidth > > abstraction, they must use boost. Libstout is a 3rd party library on > > github, so there is an upside to not relying on boost. :) > > > > I like the idea of keeping things precise, but it seems like > > simplifying this to a double bitsPerSecond is sufficient. There's loss on > > the way out anyway, as you convert to doubles, correct? If it turns out > > that we need the extra precision, then we can consider boost/rational at > > that point? > > > > Duration was a simple double implementation, and once we realized it > > wasn't sufficient, we fixed it. I think the same approach here can keep > > things simple for now, and adjust if there's a need. > > > > Thinking about how this might be used, I would expect nearly all of the > > cases to operate with Seconds(1) as the duration. In which case, using > > rational doesn't give us anything, right? > > > > Let me know your thoughts!
By "an event is fired" I mean if we are not using a loop to monitor the tx, rx bits with a fixed interval but we check it when an event occurs such as upon receiving a message, system signal or other things if some condition holds, then the Duration could be e.g. 1231.23243243243 seconds since the starting point of the current monitoring cycle. Ok I am all for adding things when needed so I am OK with changing it to use a double for now. - Jiang Yan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/11542/#review21462 ----------------------------------------------------------- On May 31, 2013, 9:20 p.m., Jiang Yan Xu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/11542/ > ----------------------------------------------------------- > > (Updated May 31, 2013, 9:20 p.m.) > > > Review request for mesos, Benjamin Hindman, Vinod Kone, and Ben Mahler. > > > Description > ------- > > - This implementation uses Boost::rational<uint64_t> to store both the bits > and the nanoseconds as integers to preserve precision. > - It requires the boost lib to be repackaged to include Boost::rational. > - The usage 'rational' handles avoid overflow cases better (it doesn't) than > simply multiply the denominators in various arithmetic operations. > - Bandwidth always >= 0 > - Bandwidth constructor passes 'boost::bad_rational' up when the denominator > is zero. > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/Makefile.am > 7a9ede62145e3150f7af6675d4384feafd9c0a88 > 3rdparty/libprocess/3rdparty/boost-1.53.0.tar.gz > 770d837aaba23d031b04ad77658f339587174aae > 3rdparty/libprocess/3rdparty/stout/Makefile.am > 84062a0e1dfe4ec04bac7cac5ebaac4b945eb66e > 3rdparty/libprocess/3rdparty/stout/include/stout/bandwidth.hpp PRE-CREATION > 3rdparty/libprocess/3rdparty/stout/tests/bandwidth_tests.cpp PRE-CREATION > > Diff: https://reviews.apache.org/r/11542/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Jiang Yan Xu > >
