Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BEGINRELEASENOTES
TimedReader
andTimedWriter
decorators that allow to wrap (interface conforming) readers and writers and record the times different operations take. The times are recorded on two levels: setup times, like constructing a reader or "one-time" calls and per event times, for things that happen each event (e.g.writeEvent
orreadCollection
). Additionally theBenchmarkRecorder
in principle also allows to track additional things outside of these decorators.ENDRELEASENOTES
This PR adds some generic utility functionality to wrap member function calls in between pairs of calls to
std::chrono::high_resolution_clock::now()
to calculate how long the execution takes. These utilities, placed in thepodio::benchmark
namespace are then used in the staticTimedWriter
andTimedReader
decorators together with theBenchmarkRecorder
class that takes care of recording the times at different granularities into a root file.In the end, I think, the interface for using this is not too bad, as can be seen by the usage of two newly added tests that use these decorators. Basically, it is necessary to setup a
podio::benchmark::BenchmarkRecorder
and pass that to the decorators as first argument during construction. From that point on the decorated reader/writer should work exactly the same as the undecorated ones.