LDMX Software
|
Class to interface between framework::Process and various measurements that can eventually be written into the output histogram file. More...
#include <Tracker.h>
Public Member Functions | |
Tracker (TDirectory *storage_directory, const std::vector< std::string > &names) | |
Create the tracker with a specific destination for writing information. | |
~Tracker () | |
Close up tracking and write all of the data collected to the storage directory. | |
void | absolute_start () |
literally first line of Process::run | |
void | absolute_stop () |
literally last line of Process::run (if run compeletes without error) | |
void | start (Callback cb, std::size_t i_proc) |
start the timer for a specific callback and specific processor | |
void | stop (Callback cb, std::size_t i_proc) |
stop the timer for a specific callback and specific processor | |
void | end_event (bool completed) |
inform us that we finished an event (and whether it was completed or not) | |
Private Attributes | |
TDirectory * | storage_directory_ |
handle to the destination for the data | |
TTree * | event_data_ |
event-by-event perf info | |
bool | event_completed_ |
buffer for bool flag on if event completed | |
Timer | absolute_ |
timer from the first line of Process::run to the last line | |
std::vector< std::vector< Timer > > | processor_timers_ |
a timer for each processor in the sequence and each callback | |
std::vector< std::string > | names_ |
names of the processors in the sequence for serialization | |
Static Private Attributes | |
static const std::string | ALL = "__ALL__" |
Special name representing "all" processors in the sequence. | |
Class to interface between framework::Process and various measurements that can eventually be written into the output histogram file.
framework::performance::Tracker::Tracker | ( | TDirectory * | storage_directory, |
const std::vector< std::string > & | names | ||
) |
Create the tracker with a specific destination for writing information.
[in] | storage_directory | directory in-which to write data when closing |
[in] | names | sequence of processor names we will be tracking |
Create the event-by-event data TTree while within the storage directory. This means the event data TTree will be connected to this file automatically and will be written there and full synchronized when that file is closed
Copy the processor names passed to us and include an extra name at the beginning representing a timer encompasing all of the processors in the sequence
Allocate timers for each of the callbacks and each of the processors
Attach the processor timers to the event-by-event data TTree as branches
We add an extra .
character after the branch name to tell ROOT to make sure to fully-specify the names of the sub-branches. This makes it a bit easier for other tools (e.g. uproot
) to load the data into memory without clashes.
Section 14.10.4 https://root.cern.ch/root/htmldoc/guides/users-guide/Trees.html#adding-a-tbranch-to-hold-an-object
Definition at line 7 of file Tracker.cxx.
References ALL, event_completed_, event_data_, names_, processor_timers_, and storage_directory_.
framework::performance::Tracker::~Tracker | ( | ) |
Close up tracking and write all of the data collected to the storage directory.
Write the non-event callbacks in their own directories, this data is then accessible as single data-points instead of a TTree of entires
Definition at line 64 of file Tracker.cxx.
References absolute_, names_, processor_timers_, storage_directory_, and framework::performance::Timer::write().
void framework::performance::Tracker::absolute_start | ( | ) |
literally first line of Process::run
Definition at line 86 of file Tracker.cxx.
References absolute_, and framework::performance::Timer::start().
Referenced by framework::Process::run().
void framework::performance::Tracker::absolute_stop | ( | ) |
literally last line of Process::run (if run compeletes without error)
Definition at line 88 of file Tracker.cxx.
References absolute_, and framework::performance::Timer::stop().
Referenced by framework::Process::run().
void framework::performance::Tracker::end_event | ( | bool | completed | ) |
inform us that we finished an event (and whether it was completed or not)
Make sure to reset the timer after the event data has been filled so that if a future event is not completed (and some timers are not started or ended), that can be reflected in the serialized data.
Definition at line 98 of file Tracker.cxx.
References event_completed_, event_data_, names_, and processor_timers_.
Referenced by framework::Process::process().
void framework::performance::Tracker::start | ( | Callback | cb, |
std::size_t | i_proc | ||
) |
start the timer for a specific callback and specific processor
Definition at line 90 of file Tracker.cxx.
References processor_timers_.
Referenced by framework::Process::newRun(), framework::Process::onFileClose(), framework::Process::onFileOpen(), framework::Process::process(), and framework::Process::run().
void framework::performance::Tracker::stop | ( | Callback | cb, |
std::size_t | i_proc | ||
) |
stop the timer for a specific callback and specific processor
Definition at line 94 of file Tracker.cxx.
References processor_timers_.
Referenced by framework::Process::newRun(), framework::Process::onFileClose(), framework::Process::onFileOpen(), framework::Process::process(), and framework::Process::run().
|
private |
timer from the first line of Process::run to the last line
Definition at line 61 of file Tracker.h.
Referenced by absolute_start(), absolute_stop(), and ~Tracker().
|
staticprivate |
|
private |
buffer for bool flag on if event completed
Definition at line 58 of file Tracker.h.
Referenced by end_event(), and Tracker().
|
private |
event-by-event perf info
Definition at line 56 of file Tracker.h.
Referenced by end_event(), and Tracker().
|
private |
names of the processors in the sequence for serialization
Definition at line 74 of file Tracker.h.
Referenced by end_event(), Tracker(), and ~Tracker().
|
private |
a timer for each processor in the sequence and each callback
The timers for the process Callback (Producer::produce or Analyzer::analyze) need to stay in the same memory location during the lifetime of this object. This is because the address of those timers is given to event_data_ to watch (and eventually serialize) while processing. Effectively, this means the size and shape of this member should be set in the constructor and then it should not be changed.
Definition at line 72 of file Tracker.h.
Referenced by end_event(), start(), stop(), Tracker(), and ~Tracker().
|
private |
handle to the destination for the data
Definition at line 54 of file Tracker.h.
Referenced by Tracker(), and ~Tracker().