From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19746 invoked by alias); 2 Feb 2007 13:33:58 -0000 Received: (qmail 19735 invoked by uid 22791); 2 Feb 2007 13:33:57 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (213.8.233.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 02 Feb 2007 13:33:49 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-141-235.inter.net.il [80.230.141.235]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id HAP15869 (AUTH halo1); Fri, 2 Feb 2007 15:33:41 +0200 (IST) Date: Fri, 02 Feb 2007 13:33:00 -0000 Message-Id: From: Eli Zaretskii To: Nick Roberts CC: gdb-patches@sources.redhat.com In-reply-to: <17852.13579.802713.886821@kahikatea.snap.net.nz> (message from Nick Roberts on Sun, 28 Jan 2007 18:30:51 +1300) Subject: Re: [PATCH] MI: new timing command Reply-to: Eli Zaretskii References: <17814.10139.269708.848818@kahikatea.snap.net.nz> <17814.58031.865155.682869@kahikatea.snap.net.nz> <20061231042547.GA3236@nevyn.them.org> <17815.18190.987950.612053@kahikatea.snap.net.nz> <20061231054946.GA4873@nevyn.them.org> <17815.27092.497145.908734@kahikatea.snap.net.nz> <20061231151527.GC16449@nevyn.them.org> <200612311524.kBVFObud010411@brahms.sibelius.xs4all.nl> <200612311609.kBVG9Fgh022431@brahms.sibelius.xs4all.nl> <17816.34925.514170.51734@farnswood.snap.net.nz> <17817.34304.221915.628057@kahikatea.snap.net.nz> <17836.26941.915573.399839@kahikatea.snap.net.nz> <17842.33386.836316.276127@kahikatea.snap.net.nz> <17851.52589.491047.323275@kahikatea.snap.net.nz> <17852.13579.802713.886821@kahikatea.snap.net.nz> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-02/txt/msg00017.txt.bz2 > From: Nick Roberts > Date: Sun, 28 Jan 2007 18:30:51 +1300 > Cc: gdb-patches@sources.redhat.com > > > > Well it was explained to me that get_run_time basically returns wallclock > > > time when getrusage isn't defined. > > > > Not necessarily. Take a look at getruntime.c: it can use `times' when > > that is available. `times' returns the sum of user and system times, > > not the wallclock time. > > I don't recollect this point being made earlier but anyway I've tried to make > the necessary changes below. This is okay with me, but please use 1000000L rather than just 1000000 here: > + tv->utime.tv_usec = usec - 1000000*tv->utime.tv_sec; and here: > + static long > + timeval_diff (struct timeval start, struct timeval end) > + { > + return ((end.tv_sec - start.tv_sec) * 1000000) > + + (end.tv_usec - start.tv_usec); > + } This is to avoid a possible overflow of a 32-bit int on systems where tv_sec is a 32-bit type. Other than that, this patch can go in, but please show here the exact patch you commit, since you didn't show it in the message to which I'm replying. Thanks.