[Top][All Lists]

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

Re: Would timevar be accepted in gnulib?

From: Bruno Haible
Subject: Re: Would timevar be accepted in gnulib?
Date: Fri, 21 Sep 2018 14:04:14 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-134-generic; KDE/5.18.0; x86_64; ; )

Hi Akim,

> Would there be some interest for this in gnulib?

There is well a place for modules like this one in gnulib. See

> 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:
  * '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.
  * 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.

> 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;
     init_timevar ();
     timevar_start (&tv_total);

     timevar_push (&tv_reader);
     reader ();
     timevar_pop (&tv_reader);

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


reply via email to

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