LDMX Software
Tracker.h
1#ifndef FRAMEWORK_PERFORMANCE_TRACKER
2#define FRAMEWORK_PERFORMANCE_TRACKER
3
4#include <TDirectory.h>
5#include <TTree.h>
6
7#include <map>
8
9#include "Framework/Performance/Callback.h"
10#include "Framework/Performance/Timer.h"
11
12namespace framework::performance {
13
20class Tracker {
21 public:
28 Tracker(TDirectory *storage_directory, const std::vector<std::string> &names);
33 ~Tracker();
35 void absolute_start();
37 void absolute_stop();
39 void start(Callback cb, std::size_t i_proc);
41 void stop(Callback cb, std::size_t i_proc);
43 void end_event(bool completed);
44
45 private:
52 static const std::string ALL;
54 TDirectory *storage_directory_;
59
72 std::vector<std::vector<Timer>> processor_timers_;
74 std::vector<std::string> names_;
75};
76} // namespace framework::performance
77
78#endif
Time how long a specific operation takes and serialize the result with ROOT.
Definition Timer.h:38
Class to interface between framework::Process and various measurements that can eventually be written...
Definition Tracker.h:20
void start(Callback cb, std::size_t i_proc)
start the timer for a specific callback and specific processor
Definition Tracker.cxx:90
TDirectory * storage_directory_
handle to the destination for the data
Definition Tracker.h:54
std::vector< std::string > names_
names of the processors in the sequence for serialization
Definition Tracker.h:74
void end_event(bool completed)
inform us that we finished an event (and whether it was completed or not)
Definition Tracker.cxx:98
bool event_completed_
buffer for bool flag on if event completed
Definition Tracker.h:58
static const std::string ALL
Special name representing "all" processors in the sequence.
Definition Tracker.h:52
~Tracker()
Close up tracking and write all of the data collected to the storage directory.
Definition Tracker.cxx:64
TTree * event_data_
event-by-event perf info
Definition Tracker.h:56
void stop(Callback cb, std::size_t i_proc)
stop the timer for a specific callback and specific processor
Definition Tracker.cxx:94
void absolute_start()
literally first line of Process::run
Definition Tracker.cxx:86
void absolute_stop()
literally last line of Process::run (if run compeletes without error)
Definition Tracker.cxx:88
Timer absolute_
timer from the first line of Process::run to the last line
Definition Tracker.h:61
std::vector< std::vector< Timer > > processor_timers_
a timer for each processor in the sequence and each callback
Definition Tracker.h:72