This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] MI: new timing command
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Nick Roberts <nickrob at snap dot net dot nz>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 02 Feb 2007 15:33:41 +0200
- Subject: Re: [PATCH] MI: new timing command
- References: <17814.10139.269708.848818@kahikatea.snap.net.nz> <u8xgp2wnm.fsf@gnu.org> <17814.58031.865155.682869@kahikatea.snap.net.nz> <umz541yqg.fsf@gnu.org> <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> <E1H12lf-0002Zf-GT@zigzag.lvk.cs.msu.su> <200612311609.kBVG9Fgh022431@brahms.sibelius.xs4all.nl> <17816.34925.514170.51734@farnswood.snap.net.nz> <E1H1GB1-0000Da-7F@fencepost.gnu.org> <17817.34304.221915.628057@kahikatea.snap.net.nz> <u1wmecb5c.fsf@gnu.org> <17836.26941.915573.399839@kahikatea.snap.net.nz> <u1wlpvca3.fsf@gnu.org> <17842.33386.836316.276127@kahikatea.snap.net.nz> <u1wlgbjwr.fsf@gnu.org> <17851.52589.491047.323275@kahikatea.snap.net.nz> <uejpfaipa.fsf@gnu.org> <17852.13579.802713.886821@kahikatea.snap.net.nz>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Nick Roberts <nickrob@snap.net.nz>
> 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.