bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: timevar: 3/3: use clock_gettime to get wall clock time


From: Bruno Haible
Subject: Re: timevar: 3/3: use clock_gettime to get wall clock time
Date: Sat, 13 Oct 2018 18:11:49 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-137-generic; KDE/5.18.0; x86_64; ; )

Hi Akim,

> we measure integral types, let’s stick with them.
> The less I use floating types, the happier I am.

Fine with me. I must have misunderstood you.

> It’s of course more precise when you have tons of utils (coreutils),
> or several libraries, etc.

Yes. Not every platform supports GNU ld's --as-needed, and not every
package like to make use of it even if GNU ld has it. (It does matter
for -lpthread, for example.)

> xtime_make doesn’t do it.  I should have factored
> this there.
> 
> I did that.  I hope that’s not a problem.  ?

I don't know. Paul will surely speak up if he doesn't like it.

> >> +      const float tiny = 5e-3;
> > 
> > Shouldn't that be 0.5e-3 for usr and sys, and 0.5e-6 for wall,
> > to match the number of decimal places printed below?
> 
> Wall is so precise that it almost means « dump everything ».
> For Bison, that’s noise (to my eyes).
> 
>                           CPU user      CPU system    wall clock      
>  reader                   0,017 ( 3%)   0,002 (25%)   0,019317 ( 4%)
>  reducing the grammar     0,000 ( 0%)   0,000 ( 0%)   0,000118 ( 0%)
>  computing the sets       0,000 ( 0%)   0,000 ( 0%)   0,000048 ( 0%)
>  LR(0)                    0,003 ( 0%)   0,000 ( 0%)   0,002693 ( 0%)
>  LALR(1)                  0,001 ( 0%)   0,000 ( 0%)   0,001525 ( 0%)
>  conflicts                0,001 ( 0%)   0,000 ( 1%)   0,000686 ( 0%)
>  outputting report        0,024 ( 5%)   0,001 ( 8%)   0,024495 ( 5%)
>  parser action tables     0,017 ( 3%)   0,000 ( 0%)   0,017155 ( 3%)
>  outputting parser        0,011 ( 2%)   0,001 (15%)   0,050501 (11%)
>  running m4               0,369 (83%)   0,004 (46%)   0,332628 (73%)
>  freeing                  0,001 ( 0%)   0,000 ( 0%)   0,000970 ( 0%)
>  total time               0,443         0,008         0,450210
> 
> I guess you would still like to see it

I would like to see it if the total wall time is 0,000146.

> Or we filter on the percentages.

Yes, filtering on percentages is the way to go. The user doesn't
care about contributions < 1% or < 0.5%. When people draw pie charts,
such minimal contributions are usually combined into "Other", but
here you can just as well omit them entirely.

> diff --git a/lib/timevar.h b/lib/timevar.h
> index ff443fed6..9ea94f71f 100644
> --- a/lib/timevar.h
> +++ b/lib/timevar.h
> ...
> @@ -129,6 +131,14 @@ void timevar_print (FILE *fp);
>  
>  extern int timevar_enabled;
>  
> +/* Control which timevars are displayed by timevar_print.  If a
> +   timevar has usr and sys times less than TIMEVAR_TINY (5e-3 by
> +   default) and wall time less than TIMEVAR_WALL_TINY (5e-6 by
> +   default), don't display it.  */
> +
> +float timevar_tiny;
> +float timevar_wall_tiny;

These declarations need 'extern', otherwise you'll get "symbol multiply
defined" errors when linking.

In order not to fall into this trap, I like to prefix *all* declarations
in .h file with 'extern'. Yes, it's more verbose, but it's more systematic.

The rest looks fine.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]