TBenchmark strategy

Hi

I found that name-based benchmarking with TBenchmark very useful. How ever, there are something confusion with it.

  1. The TBenchmark::Start() function for an existing name would call Continue() of the corresponding stopwatch. This means one can not measure a group of code many times. For example, I want to measure the total time spend in a function, which would be called many times, in the whole session, So I put a gBenchmark->Start() in the beginning to the function, and a gBenchmark->Stop() at the end, then print a Summary() when the program exits. Unfortunately this will give the total time of the session, not the time spend in the function, because the Continue() function of TStopwatch will count the time from the last Start(), not the time between Start()s/Continue()s and Stop()s.
    Is it a bug or is it a design? Is there any way to do what I mentioned without re-invent the wheel?

  2. The document of TBenchmark::Start() mentioned that “If name is an already existing benchmark, existing parameters are reset.” However, it is not like that in the source code. #-o Maybe someone would like to review it and correct if needed?

Thanks.

Hi,

concerning 1 this is the design. Concerning 2 I’ve corrected the comment to reflect that Start()ing again will resume the timing.

We can add the cumulative feature to TBenchmark (or you can send a patch :wink:). Use root.cern.ch/bugs to file a enhancement request or to submit the patch.

Cheers, Fons.