Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHTimer Class Reference

#include <coresoftware/blob/master/offline/framework/phool/PHTimer.h>

+ Collaboration diagram for PHTimer:

Classes

class  Frequency
 internal frequency read from cpu information file More...
 
struct  time_struct
 used to store high precision time using two integers More...
 

Public Types

enum  State { STOP = 0, RUN = 1 }
 enum for timer state More...
 

Public Member Functions

State get_state (void) const
 access timer state
 
 PHTimer (const std::string &name="Generic Timer")
 Construct with a name.
 
void stop ()
 stops the counter
 
void restart ()
 Restart timer.
 
void print (std::ostream &os=std::cout) const
 Dump elapsed time to provided ostream.
 
void print_stat (std::ostream &os=std::cout) const
 Dump statistics.
 
void set_name (const std::string &name)
 Set timer name.
 
std::string get_name (void) const
 get timer name
 
double get_accumulated_time (void) const
 get cumulated time
 
unsigned int get_ncycle (void) const
 get number of cycles
 
double get_time_per_cycle (void) const
 get averaged time/cycle
 
double elapsed (void) const
 retrieve elapsed value since last restart (in ms)
 
void test (double time, std::ostream &os=std::cout)
 test PHTimer for a given amount of time (in ms)
 

Static Public Member Functions

static void PRINT (std::ostream &os=std::cout, const std::string &message="")
 print a message (formated) to a stream
 

Static Private Member Functions

static time_struct get_clock_counts (void)
 gets time from cpu clock counts
 
static double get_difference (const time_struct &, const time_struct &)
 returns difference between to time
 

Private Attributes

std::string _name
 timer name
 
State _state
 timer state
 
time_struct _start_time
 start time structure
 
time_struct _stop_time
 stop time structure
 
double _accumulated_time
 cumulated time
 
unsigned int _ncycle
 number of restart/stop cycles
 

Static Private Attributes

static Frequency _frequency = PHTimer::Frequency()
 static frequency object
 
static const double _twopower32 = pow(2, 32)
 to stores 2^32
 

Detailed Description

high precision timer

Definition at line 25 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 25 of file PHTimer.h

Member Enumeration Documentation

enum for timer state

Enumerator:
STOP 
RUN 

Definition at line 29 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 29 of file PHTimer.h

Constructor & Destructor Documentation

PHTimer::PHTimer ( const std::string &  name = "Generic Timer")
inlineexplicit

Construct with a name.

Definition at line 42 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 42 of file PHTimer.h

References PHTimer::time_struct::_low, and _stop_time.

Member Function Documentation

double PHTimer::elapsed ( void  ) const
inline

retrieve elapsed value since last restart (in ms)

Definition at line 126 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 126 of file PHTimer.h

References _start_time, _state, _stop_time, get_clock_counts(), get_difference(), and RUN.

Referenced by print(), PHSimpleKFProp::process_event(), and stop().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double PHTimer::get_accumulated_time ( void  ) const
inline

get cumulated time

Definition at line 108 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 108 of file PHTimer.h

References _accumulated_time.

Referenced by TrkrNtuplizer::fillOutputNtuples(), SvtxEvaluator::fillOutputNtuples(), MakeSourceLinks::getSourceLinks(), PHActsTrkFitter::getTrackFitResult(), PHActsTrkFitter::loopTracks(), PHRaveVertexing::process_event(), PHActsTrkFitter::process_event(), and PHActsTrkFitter::updateSvtxTrack().

+ Here is the caller graph for this function:

static time_struct PHTimer::get_clock_counts ( void  )
inlinestaticprivate

gets time from cpu clock counts

Definition at line 207 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 207 of file PHTimer.h

References PHTimer::time_struct::_high, PHTimer::time_struct::_low, rdtsc, and t.

Referenced by elapsed(), restart(), and stop().

+ Here is the caller graph for this function:

double PHTimer::get_difference ( const time_struct t0,
const time_struct t1 
)
staticprivate

returns difference between to time

Definition at line 64 of file PHTimer.cc.

View newest version in sPHENIX GitHub at line 64 of file PHTimer.cc

References _frequency, PHTimer::time_struct::_high, PHTimer::time_struct::_low, _twopower32, and PHTimer::Frequency::period().

Referenced by elapsed().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string PHTimer::get_name ( void  ) const
inline

get timer name

Definition at line 102 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 102 of file PHTimer.h

References _name.

unsigned int PHTimer::get_ncycle ( void  ) const
inline

get number of cycles

Definition at line 114 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 114 of file PHTimer.h

References _ncycle.

State PHTimer::get_state ( void  ) const
inline

access timer state

Definition at line 36 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 36 of file PHTimer.h

References _state.

double PHTimer::get_time_per_cycle ( void  ) const
inline

get averaged time/cycle

Definition at line 120 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 120 of file PHTimer.h

References _accumulated_time, and _ncycle.

void PHTimer::print ( std::ostream &  os = std::cout) const
inline

Dump elapsed time to provided ostream.

Definition at line 71 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 71 of file PHTimer.h

References _name, elapsed(), os, and PRINT().

Referenced by test().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PHTimer::PRINT ( std::ostream &  os = std::cout,
const std::string &  message = "" 
)
static

print a message (formated) to a stream

Definition at line 80 of file PHTimer.cc.

View newest version in sPHENIX GitHub at line 80 of file PHTimer.cc

Referenced by print(), PHTimeServer::print(), print_stat(), PHTimeServer::print_stat(), Fun4AllServer::PrintTimer(), and test().

+ Here is the caller graph for this function:

void PHTimer::print_stat ( std::ostream &  os = std::cout) const
inline

Dump statistics.

Definition at line 80 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 80 of file PHTimer.h

References _accumulated_time, _name, _ncycle, os, and PRINT().

Referenced by PgPostBankBackupManager::CleanTable(), PgPostBankBackupManager::commitAllBankfromTFile(), and PgPostBankBackupManager::fetchAllBank2TFile().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PHTimer::restart ( )
inline

Restart timer.

Definition at line 64 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 64 of file PHTimer.h

References _start_time, _state, get_clock_counts(), and RUN.

Referenced by PHG4PhenixEventAction::BeginOfEventAction(), PgPostBankBackupManager::CleanTable(), PgPostBankBackupManager::commitAllBankfromTFile(), PgPostBankBackupManager::fetchAllBank2TFile(), TrkrNtuplizer::fillOutputNtuples(), SvtxEvaluator::fillOutputNtuples(), MakeSourceLinks::getSourceLinks(), PHActsTrkFitter::getTrackFitResult(), PHActsTrkFitter::loopTracks(), MvtxApplyHotDead::process_event(), MvtxAlign::process_event(), MvtxPrototype2Align::process_event(), PHSimpleKFProp::process_event(), PHRaveVertexing::process_event(), PHActsTrkFitter::process_event(), test(), and PHActsTrkFitter::updateSvtxTrack().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PHTimer::set_name ( const std::string &  name)
inline

Set timer name.

Definition at line 96 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 96 of file PHTimer.h

References _name, and perf_headwind::name.

void PHTimer::stop ( )
inline
void PHTimer::test ( double  time,
std::ostream &  os = std::cout 
)
inline

test PHTimer for a given amount of time (in ms)

Definition at line 134 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 134 of file PHTimer.h

References _name, os, print(), PRINT(), restart(), and Acts::Test::tmp().

+ Here is the call graph for this function:

Member Data Documentation

double PHTimer::_accumulated_time
private

cumulated time

Definition at line 238 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 238 of file PHTimer.h

Referenced by get_accumulated_time(), get_time_per_cycle(), print_stat(), and stop().

PHTimer::Frequency PHTimer::_frequency = PHTimer::Frequency()
staticprivate

static frequency object

Definition at line 220 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 220 of file PHTimer.h

Referenced by get_difference().

std::string PHTimer::_name
private

timer name

Definition at line 226 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 226 of file PHTimer.h

Referenced by get_name(), print(), print_stat(), set_name(), and test().

unsigned int PHTimer::_ncycle
private

number of restart/stop cycles

Definition at line 241 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 241 of file PHTimer.h

Referenced by get_ncycle(), get_time_per_cycle(), print_stat(), and stop().

time_struct PHTimer::_start_time
private

start time structure

Definition at line 232 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 232 of file PHTimer.h

Referenced by elapsed(), and restart().

State PHTimer::_state
private

timer state

Definition at line 229 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 229 of file PHTimer.h

Referenced by elapsed(), get_state(), restart(), and stop().

time_struct PHTimer::_stop_time
private

stop time structure

Definition at line 235 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 235 of file PHTimer.h

Referenced by elapsed(), PHTimer(), and stop().

const double PHTimer::_twopower32 = pow(2, 32)
staticprivate

to stores 2^32

Definition at line 223 of file PHTimer.h.

View newest version in sPHENIX GitHub at line 223 of file PHTimer.h

Referenced by get_difference().


The documentation for this class was generated from the following files: