Skip to content

Counters: add support for std::chrono::duration

Frank Winklmeier requested to merge fwinkl/Gaudi:duration_counter into master

This MR is another step towards Counter-based timers (!787 (merged)):

  1. The first commit just adds a few additional static_cast to Counters.h to ensure type matches for non-trivial Arithmetic types. I think those should have been there in the first place but problems only start appearing once you use the Counters with non-builtin types that have more strict conversion rules (e.g. std::chrono::duration<long,...> and std::chrono::duration<unsigned long,...> do not implicitly convert)
  2. Add helpers and a test case for using the Counters with std::chrono::duration objects. While one could simply accumulate std::chrono::duration::counts() without any of these changes, it's convenient to preserve the units as they can readily be used in the statistics printout.

I am not sure I put those new Chrono header files into the right location. Please advise if they should go somewhere else.

Edited by Frank Winklmeier

Merge request reports

Loading