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 "Framework/Performance/Callback.h"
8#include "Framework/Performance/Timer.h"
9
10namespace framework::performance {
11
18class Tracker {
19 public:
26 Tracker(TDirectory* storage_directory, const std::vector<std::string>& names);
31 ~Tracker();
33 void absoluteStart();
35 void absoluteStop();
37 void start(Callback cb, std::size_t i_proc);
39 void stop(Callback cb, std::size_t i_proc);
41 void endEvent(bool completed);
42
43 private:
50 static const std::string ALL;
52 TDirectory* storage_directory_;
57
70 std::vector<std::vector<Timer>> processor_timers_;
72 std::vector<std::string> names_;
73};
74} // namespace framework::performance
75
76#endif
Time how long a specific operation takes and serialize the result with ROOT.
Definition Timer.h:39
Class to interface between framework::Process and various measurements that can eventually be written...
Definition Tracker.h:18
void start(Callback cb, std::size_t i_proc)
start the timer for a specific callback and specific processor
Definition Tracker.cxx:90
void absoluteStop()
literally last line of Process::run (if run compeletes without error)
Definition Tracker.cxx:88
Tracker(TDirectory *storage_directory, const std::vector< std::string > &names)
Create the tracker with a specific destination for writing information.
Definition Tracker.cxx:7
TDirectory * storage_directory_
handle to the destination for the data
Definition Tracker.h:52
std::vector< std::string > names_
names of the processors in the sequence for serialization
Definition Tracker.h:72
bool event_completed_
buffer for bool flag on if event completed
Definition Tracker.h:56
static const std::string ALL
Special name representing "all" processors in the sequence.
Definition Tracker.h:50
void endEvent(bool completed)
inform us that we finished an event (and whether it was completed or not)
Definition Tracker.cxx:98
~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:54
void stop(Callback cb, std::size_t i_proc)
stop the timer for a specific callback and specific processor
Definition Tracker.cxx:94
Timer absolute_
timer from the first line of Process::run to the last line
Definition Tracker.h:59
std::vector< std::vector< Timer > > processor_timers_
a timer for each processor in the sequence and each callback
Definition Tracker.h:70
void absoluteStart()
literally first line of Process::run
Definition Tracker.cxx:86