This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] MI: new timing command
On Sun, Dec 31, 2006 at 06:13:50PM +1300, Nick Roberts wrote:
> > The autoconf manual has information about this sort of thing. I see
> > that libiberty guards it, sometimes with HAVE_GETRUSAGE and other times
> > with that and HAVE_SYS_RESOURCE_H.
> >
> > Will libiberty's get_run_time suffice for whatever you were doing,
> > Nick?
>
> The manual says:
>
> -- Replacement: long get_run_time (void)
> Returns the time used so far, in microseconds. If possible, this
> is the time used by this process, else it is the elapsed time
> since the process started.
>
> Without looking at the code, I would guess it's just a wrapper for getrusage
> and it uses something like gettimeofday for elapsed time when it can't find
> it. I think if user time isn't available it's best just to make
> -enable-timings fail, so I'll use Eli's suggestion.
In that case you can copy the necessary guards from that file.
However, it does more than just getrusage - it also supports
platforms with times() but without getrusage, which IIRC includes
Windows, so it might be better to use it.
I was wondering if we should make this a normal GDB setting, and use5C
"-gdb-set mi profiling on" to enable it. There's already a maint
setting to do the same thing for the CLI.
--
Daniel Jacobowitz
CodeSourcery