EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHTimer Class Reference

#include <fun4all_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(), 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 SvtxEvaluator::fillOutputNtuples(), PHRTreeSeeding::FillTree(), PHActsTrkFitter::getTrackFitResult(), PHActsTrkFitter::loopTracks(), PHHoughSeeding::print_timers(), PHGenFitTrkProp::print_timers(), PHRTreeSeeding::Process(), 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(), 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, 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
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 name.

void PHTimer::stop ( )
inline

stops the counter

Definition at line 54 of file PHTimer.h.

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

References _accumulated_time, _ncycle, _state, _stop_time, elapsed(), get_clock_counts(), and STOP.

Referenced by __example_1.f__(), __example_2.f__(), __example_3.f__(), __example_4.f__(), alphas(), PgPostBankBackupManager::CleanTable(), PgPostBankBackupManager::commitAllBankfromTFile(), ctq4pdf(), ctq5pdf(), ctq6pdf(), d1mach(), PHG4PhenixEventAction::EndOfEventAction(), PgPostBankBackupManager::fetchAllBank2TFile(), SvtxEvaluator::fillOutputNtuples(), PHRTreeSeeding::FillTree(), fitparton(), PHHoughSeeding::full_track_seeding(), PHActsTrkFitter::getTrackFitResult(), grv98pa(), hijing(), hijset(), SvtxEvaluator::Init(), PHPatternReco::InitRun(), PHRaveVertexing::InitRun(), itafun(), linit(), lmidat(), lminew(), PHActsTrkFitter::loopTracks(), luerrm(), lutaud(), lutest(), lweits(), lxsect(), nextun(), nextun5(), nextun6(), PHGenFitTrkProp::OutputPHGenFitTrack(), parpolnew(), parton(), partonx6(), pollazimu(), pollinit(), PHHoughSeeding::Process(), PHGenFitTrkProp::Process(), PHRTreeSeeding::Process(), PHRaveVertexing::process_event(), PHActsTrkFitter::process_event(), pyhiinit(), pyhiinki(), pyhimaxi(), pyhirand(), pyhitest(), pystop(), pyupev(), radgen_init(), rndmq(), PHGenFitTrkProp::SearchHitsNearBy(), setctq4(), setctq5(), setctq6(), PHHoughSeeding::Setup(), PHGenFitTrkProp::Setup(), PHInitZVertexing::Setup(), PHGenFitTrkProp::TrackPropPatRec(), PHActsTrkFitter::updateSvtxTrack(), vacpol(), and xytabl().

+ Here is the call graph for this function:

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, print(), PRINT(), and restart().

+ 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: