On Thu, 11 Apr 2013, Kenneth D. Merry wrote:
On Thu, Apr 11, 2013 at 17:06:44 +1000, Bruce Evans wrote:
...
It is now clear that this is still too verbose, since cur_secs and prev_secs
are not used except to initialize etime. Simplifying this gives:
etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec +
(ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9;
This might need casting to double of ctx->cur_time.tv_sec, in case time_t
is unsigned and the time went backwards. Otherwise, this should be the
usual expression for subtracting timespecs.
The time can't go backwards in this case, because it is the system uptime.
I expected this, but was not sure where the timestamps are generated.
Using wall clock time causes problems measuring performance when NTP
decides that the system time needs to change. I have a local patch to dd
to fix instances of bogus performance numbers due to its using wall clock
time to measure elapsed time.
All uses of gettimeofday() are suspect. A quick grep shows other obviously
wrong ones in ping*, time and systat.
Uses of CLOCK_REALTIME are hopefully correct, but about half of them in
/usr/src/*bin seem to be incorrect. ktrace and truss are interesting.
Real times are used and are probably best for absolute times but wrong
for relative times.
Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"