Hall-D Software
alpha
|
This utility class is to help in doing detailed profiling of code. It is uses the unix itimer system (see man getitimer). It is assumed that all 3 of the hi-res timers are running. They should be because JANA starts them all at program start up. More...
#include <prof_time.h>
Classes | |
class | time_diffs |
Public Member Functions | |
prof_time () | |
virtual | ~prof_time () |
void | GetTime (void) |
void | TimeDiffNow (std::map< std::string, time_diffs > &prof_times, std::string what) |
void | TimeDiff (const prof_time &other_time, double &tdiff_real, double &tdiff_virt, double &tdiff_prof) |
Public Attributes | |
struct itimerval | real_tmr |
struct itimerval | virt_tmr |
struct itimerval | prof_tmr |
This utility class is to help in doing detailed profiling of code. It is uses the unix itimer system (see man getitimer). It is assumed that all 3 of the hi-res timers are running. They should be because JANA starts them all at program start up.
To use this, one would want to do something like the following:
Declare a container to hold timing info outside of evnt loop
static map<string, prof_time::time_diffs> prof_times;
Then, wrap the block of code you want to time with a prof_time variable and a call to its TimeDiffNow(...) method.
prof_time start_time;
<... do something ...>
start_time.TimeDiffNow(prof_times, "My code block 1");
Note that the current time is copied into the prof_time variable upon it's creation. To force the recording of a time at a position other than the line creating the object, call it's GetTime() method.
This system is designed to check all 3 timers. This might add a little more overhead than simply checking one timer, but at least this way this can be used for a broad range of purposes.
Definition at line 44 of file prof_time.h.
|
inline |
Definition at line 60 of file prof_time.h.
References GetTime().
|
inlinevirtual |
Definition at line 64 of file prof_time.h.
|
inline |
Definition at line 68 of file prof_time.h.
References prof_tmr, real_tmr, and virt_tmr.
Referenced by prof_time().
|
inline |
Definition at line 93 of file prof_time.h.
References prof_tmr, real_tmr, and virt_tmr.
Referenced by TimeDiffNow().
|
inline |
Definition at line 76 of file prof_time.h.
References prof_time::time_diffs::prof, prof_time::time_diffs::real, TimeDiff(), and prof_time::time_diffs::virt.
Referenced by DTrackFitter::FindHitsAndFitTrack(), DTrackFitter::FitTrack(), and DTrackFitter::Reset().
struct itimerval prof_time::prof_tmr |
Definition at line 117 of file prof_time.h.
Referenced by GetTime(), and TimeDiff().
struct itimerval prof_time::real_tmr |
Definition at line 115 of file prof_time.h.
Referenced by GetTime(), and TimeDiff().
struct itimerval prof_time::virt_tmr |
Definition at line 116 of file prof_time.h.
Referenced by GetTime(), and TimeDiff().