This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] MI: new timing command
> Date: Sat, 27 Jan 2007 16:53:40 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> CC: gdb-patches@sources.redhat.com
>
> m-main.c:
>
> + static void
> + timestamp (struct mi_timestamp *tv)
> + {
> + long usec;
> + #ifdef HAVE_GETRUSAGE
> + gettimeofday (&tv->wallclock, NULL);
> + getrusage (RUSAGE_SELF, &tv->rusage);
> + #else
> + usec = get_run_time ();
> + tv->wallclock.tv_sec = usec/1000000;
> + tv->wallclock.utv_sec = usec - 1000000*tv->wallclock.tv_sec;
> + tv->rusage.ru_utime.tv_sec = 0;
> + tv->rusage.ru_utime.tv_usec = 0;
> + tv->rusage.ru_stime.tv_sec = 0;
> + tv->rusage.ru_stime.tv_usec = 0;
> + #endif
> + }
Also note that this line:
> + tv->wallclock.utv_sec = usec - 1000000*tv->wallclock.tv_sec;
has a typo: it uses utv_sec instead of tv_usec.