From owner-svn-src-head@FreeBSD.ORG Fri Apr 12 10:54:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B7A09DB5; Fri, 12 Apr 2013 10:54:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 7CD0E1ECB; Fri, 12 Apr 2013 10:54:02 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id C640712140B; Fri, 12 Apr 2013 20:23:04 +1000 (EST) Date: Fri, 12 Apr 2013 20:23:04 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Kenneth D. Merry" Subject: Re: svn commit: r249334 - head/usr.bin/ctlstat In-Reply-To: <20130411224634.GA56177@nargothrond.kdm.org> Message-ID: <20130412200948.A1222@besplex.bde.org> References: <201304101601.r3AG1jZq083572@svn.freebsd.org> <20130411163712.Y1200@besplex.bde.org> <20130411224634.GA56177@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=HfxM1V48 c=1 sm=1 a=jrZi4plbApYA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=ns49S-B92uUA:10 a=gHfMRZwAIj3U6oAC7EsA:9 a=CjuIK1q_8ugA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2013 10:54:02 -0000 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