1#ifndef PODIO_TIMEDWRITER_H
2#define PODIO_TIMEDWRITER_H
13template <
class WrappedWriter>
18 template <
typename... Args>
20 m_start(ClockT::now()),
21 m_writer(WrappedWriter(std::forward<Args>(args)...)),
24 m_perEventTree(m_recorder.addTree(
"event_times", {
"write_event"})) {
25 m_recorder.addTree(
"setup_times", {
"constructor",
"finish",
"register_for_write"});
26 m_recorder.recordTime(
"setup_times",
"constructor", m_end - m_start);
30 m_recorder.recordTime(
"setup_times",
"register_for_write", m_registerTime);
31 m_recorder.Fill(
"setup_times");
38 const auto duration = benchmark::run_void_member_timed(m_writer, &WrappedWriter::registerForWrite, name);
39 m_registerTime += duration;
43 m_perEventTree.recordTime(
"write_event", benchmark::run_void_member_timed(m_writer, &WrappedWriter::writeEvent));
44 m_perEventTree.Fill();
48 m_recorder.recordTime(
"setup_times",
"finish", benchmark::run_void_member_timed(m_writer, &WrappedWriter::finish));
52 ClockT::time_point m_start;
53 WrappedWriter m_writer;
54 ClockT::time_point m_end;
57 ClockT::duration m_registerTime{std::chrono::nanoseconds{0}};
void registerForWrite(const std::string &name)
TimedWriter(benchmark::BenchmarkRecorder &recorder, Args &&... args)
std::chrono::high_resolution_clock ClockT