This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] MI: new timing command


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]