Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Apr 2013 20:23:04 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        "Kenneth D. Merry" <ken@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: svn commit: r249334 - head/usr.bin/ctlstat
Message-ID:  <20130412200948.A1222@besplex.bde.org>
In-Reply-To: <20130411224634.GA56177@nargothrond.kdm.org>
References:  <201304101601.r3AG1jZq083572@svn.freebsd.org> <20130411163712.Y1200@besplex.bde.org> <20130411224634.GA56177@nargothrond.kdm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130412200948.A1222>