On Tue, Oct 09, 2018 at 08:45:58AM -0400, Frediano Ziglio wrote: > > > > On Tue, Oct 09, 2018 at 01:14:10PM +0100, Frediano Ziglio wrote: > > > Use a single function to get monotonic time. > > > As lot of code needs nanosecond precision, spice_get_monotonic_time_ns > > > is used. > > > > > > > "lots of code needs nanosecond precision"? I looked at a few files using > > spice_get_monotonic_time_ns, and nanosecond precision did not seem > > useful in any of those (the code was adding a timeout in second to it, or > > using g_usleep, or converting it to some other unit straight away). So I > > would not add this misleading comment to the log ;) Maybe this should > > be adding a spice_get_monotonic_get_us helper so that it's clear we > > don't need that much precision? > > > > Christophe > > > > There are 32 calls and only 4 seems to require less precision than > that. We'll have to disagree here, I haven't looked at all the call sites, but I'm not far from reaching the opposite conclusion (the majority of the calls does not need ns, only a few places are less obvious). > Maybe usec are enough but as at the end we need to call > clock_gettime and use 64 bit integers anyway so using nanoseconds > by default is not more costly. I don't know if switching to > microseconds could cause some wrong rounding, surely not > switching won't have this issue. > > You just removed the XX_ms one, now we want the XX_us? At this > point let's have all XX_ns, XX_us, XX_ms and XX_s. I guess this all can be revisited later as this is getting more involved than what you initially had in mind :) > How should I change the comment? Removing it should be all that is needed. > > > diff --git a/server/utils.h b/server/utils.h > > > index 07878539..a2747cf7 100644 > > > --- a/server/utils.h > > > +++ b/server/utils.h > > > @@ -54,8 +54,9 @@ typedef int64_t red_time_t; > > > > > > #define NSEC_PER_SEC 1000000000LL > > > #define NSEC_PER_MILLISEC 1000000LL > > > +#define NSEC_PER_MICROSEC 1000 > > > > > > -/* FIXME: consider g_get_monotonic_time (), but in microseconds */ > > > +/* g_get_monotonic_time() as not enough precision */ You could probably just drop the comment. Or s/as/does not have/ if you keep it. Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel