bug-gnulib
[Top][All Lists]
Advanced

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

Re: Would timevar be accepted in gnulib?


From: Akim Demaille
Subject: Re: Would timevar be accepted in gnulib?
Date: Sat, 22 Sep 2018 16:11:55 +0200

Hi all,

Thanks for the answers!

> Le 21 sept. 2018 à 14:04, Bruno Haible <address@hidden> a écrit :
> 
> Hi Akim,
> 
>> Would there be some interest for this in gnulib?
> 
> There is well a place for modules like this one in gnulib. See
> https://www.gnu.org/software/gnulib/manual/html_node/Portability-and-Application-Code.html

Good, thanks!

>> allow self-profiling.  It does not aim at replacing real profiling
>> tools, but rather to report in a concise way the cost of various
>> phases in a program.
> 
> The documentation of this module should, IMO, state the advantages and
> disadvantages of this module compared to "real" profiling tools. The
> comparison points I can see (surely I missed some) are:
> Upsides:
>  * 'timevar' is portable. You can use it to evaluate performance issues
>    on platforms for which no profiler exists or for which you don't want
>    to install and configure one.
>  * 'timevar' can be useful for remote troubleshooting when the person
>    who has the issues does not have developer skills.
> Downsides:
>  * In my experience, when profiling, most often the result is unexpected.
>    Whereas the 'timevar' module provides no insights of new kinds. It can
>    only provide insights along the "phase" definitions that were already
>    made ahead of time.

That’s a pretty good summary :)

>> Of course I
>> guess there’s work to do for it to be accepted (doc, style, etc.),
> 
> Two suggestions:
> 
> 1) Simplify. I don't see the point of the DEFTIMEVAR layer with the enum.
>   Couldn't the code just do
>     timevar_t tv_total;
>     timevar_t tv_reader;
>     ..
>   and
>     init_timevar ();
>     timevar_start (&tv_total);
> 
>     timevar_push (&tv_reader);
>     reader ();
>     timevar_pop (&tv_reader);

I’m not sure I understand what you mean here.  The timers are
used in many places in the code, not just main().  We need some
global definition somewhere, and we want to iterate over them
when displaying the result.

What do you have in mind?

> 2) Convert from K&R C to ANSI C.

Indeed :)

I have made quite a bit of clean up in timevar, see
https://lists.gnu.org/archive/html/bison-patches/2018-09/msg00118.html

I attach below the current state of the main files.

Attachment: timevar.c
Description: Binary data

Attachment: timevar.h
Description: Binary data


reply via email to

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