timevar, get_time: Count the children time in
Akim Demaille
akim@epita.fr
Thu Aug 1 03:10:00 GMT 2002
timevar is great material! But it has a problem, at least for the use
I make of it: it doesn't count the time consumed by the children.
Even in the case of GCC, I'm not sure I understand why you don't count
it in: it does improve the accuracy.
This patch addresses this issue:
from Akim Demaille <akim@epita.fr>
* timevar.c (get_time): Cumulate children time too.
--- /home/lrde/prof/akim/src/gcc/gcc/timevar.c Sat May 18 17:16:23 2002
+++ ../lib/timevar.c Thu Aug 1 11:34:25 2002
@@ -192,15 +207,18 @@
{
#ifdef USE_TIMES
struct tms tms;
- now->wall = times (&tms) * ticks_to_msec;
- now->user = tms.tms_utime * ticks_to_msec;
- now->sys = tms.tms_stime * ticks_to_msec;
+ now->wall = times (&tms) * ticks_to_msec;
+ now->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec;
+ now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec;
#endif
#ifdef USE_GETRUSAGE
struct rusage rusage;
getrusage (RUSAGE_SELF, &rusage);
now->user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6;
now->sys = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6;
+ getrusage (RUSAGE_CHILDREN, &rusage);
+ now->user += rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6;
+ now->sys += rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6;
#endif
#ifdef USE_CLOCK
now->user = clock () * clocks_to_msec;
More information about the Gcc-patches
mailing list