Sierra Toolkit  Version of the Day
stk_classic::diag::Timer Class Reference

Class Timer implements a diagnostic timer and timer container for the collection and display of execution times. More...

#include <Timer.hpp>

Classes

struct  Metric
 

Public Member Functions

 Timer (const std::string &name, const Timer parent)
 
 Timer (const std::string &name, const Timer parent, const TimerSet &timer_set)
 
 Timer (const std::string &name, TimerMask timer_mask, const Timer parent)
 
 Timer (const std::string &name, TimerMask timer_mask, const Timer parent, const TimerSet &timer_set)
 
 Timer (TimerImpl &timer_impl)
 
 Timer (TimerImpl *timer_impl)
 
 Timer (const Timer &timer)
 
Timeroperator= (const Timer &timer)
 
const TimerList & getTimerList () const
 
TimerList::iterator begin ()
 
TimerList::const_iterator begin () const
 
TimerList::iterator end ()
 
TimerList::const_iterator end () const
 
const std::string & getName () const
 
const TimerSetgetTimerSet () const
 
TimerMask getTimerMask () const
 
bool shouldRecord () const
 
double getSubtimerLapCount () const
 
template<class T >
const Metric< T > & getMetric () const
 
double accumulateSubtimerLapCounts () const
 
Timerstart ()
 
Timerlap ()
 
Timerstop ()
 
void checkpoint () const
 
Writerdump (Writer &dout) const
 

Friends

class TimerImpl
 
class TimeBlock
 
class TimeBlockSynchronized
 
void updateRootTimer (Timer)
 
Timer createRootTimer (const std::string &, const TimerSet &)
 
void deleteRootTimer (Timer)
 
std::vector< Timer > & findTimers (Timer, const std::string &, std::vector< Timer > &)
 Member function findTimer return a vector of timers whose tail of the dot separated name from root_time to leaf matches the specified path_tail. More...
 

Detailed Description

Class Timer implements a diagnostic timer and timer container for the collection and display of execution times.

Definition at line 185 of file Timer.hpp.

Constructor & Destructor Documentation

◆ Timer() [1/5]

stk_classic::diag::Timer::Timer ( const std::string &  name,
const Timer  parent 
)

Creates a new Timer instance.

Parameters
namea std::string const reference to the name of the timer.
parenta Timer value of the parent timer.

Definition at line 727 of file Timer.cpp.

◆ Timer() [2/5]

stk_classic::diag::Timer::Timer ( const std::string &  name,
const Timer  parent,
const TimerSet timer_set 
)

Creates a new Timer instance.

Parameters
namea std::string const reference to the name of the timer.
parenta Timer value of the parent timer.
timer_seta TimerSet value of the timer set used to interpret the TimerMask's of this and children timers.

Definition at line 735 of file Timer.cpp.

◆ Timer() [3/5]

stk_classic::diag::Timer::Timer ( const std::string &  name,
TimerMask  timer_mask,
const Timer  parent 
)

Creates a new Timer instance.

Parameters
namea std::string const reference to the name of the timer.
timer_maska TimerMask value which enables this timer.
parenta Timer value of the parent timer.

Definition at line 731 of file Timer.cpp.

◆ Timer() [4/5]

stk_classic::diag::Timer::Timer ( const std::string &  name,
TimerMask  timer_mask,
const Timer  parent,
const TimerSet timer_set 
)

Creates a new Timer instance.

Parameters
namea std::string const reference to the name of the timer.
timer_maska TimerMask value which enables this timer.
parenta Timer value of the parent timer.
timer_seta TimerSet value of the timer set used to interpret the TimerMask's of this and children timers.

Definition at line 739 of file Timer.cpp.

◆ Timer() [5/5]

stk_classic::diag::Timer::Timer ( TimerImpl &  timer_impl)
inlineexplicit

Creates the root Timer timer instance.

Definition at line 362 of file Timer.hpp.

Member Function Documentation

◆ getName()

const std::string & stk_classic::diag::Timer::getName ( ) const

Member function getName returns the name of the timer.

Returns
a std::string const reference to the timer's name.

Definition at line 745 of file Timer.cpp.

◆ getTimerSet()

const TimerSet & stk_classic::diag::Timer::getTimerSet ( ) const

Member function getTimerMask returns the timer mask of the timer.

Returns
a TimerMask value to the timer mask.

Definition at line 755 of file Timer.cpp.

◆ getTimerMask()

TimerMask stk_classic::diag::Timer::getTimerMask ( ) const

Member function getTimerMask returns the timer mask of the timer.

Returns
a TimerMask value to the timer mask.

Definition at line 750 of file Timer.cpp.

◆ getSubtimerLapCount()

double stk_classic::diag::Timer::getSubtimerLapCount ( ) const

Member function getSubtimerLapCount returns the subtimer lap counter.

Returns
a Counter value of the subtimer lap counter.

Definition at line 760 of file Timer.cpp.

◆ getMetric()

template<class T >
template const Timer::Metric< HeapAlloc > & stk_classic::diag::Timer::getMetric< HeapAlloc > ( ) const

Member function getLapCount returns the lap counter metric. The lap count metric is the number of times the stop function has been executed.

Returns
a CounterMetric const reference of the lap counter metric.

Definition at line 771 of file Timer.cpp.

◆ accumulateSubtimerLapCounts()

double stk_classic::diag::Timer::accumulateSubtimerLapCounts ( ) const

Member function accumulateSubtimerLapCounts accumulates the subtimer la counts.

Returns
an int value of the count.

Definition at line 814 of file Timer.cpp.

◆ start()

Timer & stk_classic::diag::Timer::start ( )

Member function start starts the lap timer.

Returns
a Timer reference to this timer.

Definition at line 819 of file Timer.cpp.

◆ lap()

Timer & stk_classic::diag::Timer::lap ( )

Member function lap sets the lap stop time.

Returns
a Timer reference to the timer.

Definition at line 825 of file Timer.cpp.

◆ stop()

Timer & stk_classic::diag::Timer::stop ( )

Member function stop sets the lap stop time and sums the just completed lap time to the timer.

Returns
a Timer reference to the timer.

Definition at line 831 of file Timer.cpp.

◆ checkpoint()

void stk_classic::diag::Timer::checkpoint ( ) const

Member function checkpoint checkpoints the metrics by storing the total time in the checkpoint value.

Definition at line 837 of file Timer.cpp.

◆ dump()

Writer & stk_classic::diag::Timer::dump ( Writer dout) const

Member function dump writes the timer to the specified diagnostic writer.

Parameters
douta Writer variable reference to write the timer to.
Returns
a Writer reference to dout.

Definition at line 842 of file Timer.cpp.

Friends And Related Function Documentation

◆ updateRootTimer

void updateRootTimer ( Timer  )
friend

Function updateRootTimer updates the root timers stop and total metric values with the current time.

Parameters
root_timera Timer reference to the root timer.

Definition at line 394 of file Timer.cpp.

◆ createRootTimer

Timer createRootTimer ( const std::string &  ,
const TimerSet  
)
friend

Function createRootTimer creates a root timer. Root timers are the root of a timer hierarchy. The timer_set specifies the timer groupings for this root timer. The percentage of a child timer is the ratio of that timer the its root.

Parameters
namea std::string const reference to the name of the new root timer.
timer_seta TimerSet const reference of the timer set of the new root timer.
Returns
a Timer value of the new root timer.

Definition at line 402 of file Timer.cpp.

◆ deleteRootTimer

void deleteRootTimer ( Timer  )
friend

Function deleteRootTimer deletes a root timer and all of it's children timers. All children Timers are invalidated and can no longer be used.

Parameters
aTimer value of the root timer to delete.

Definition at line 411 of file Timer.cpp.

◆ findTimers

std::vector<Timer>& findTimers ( Timer  ,
const std::string &  ,
std::vector< Timer > &   
)
friend

Member function findTimer return a vector of timers whose tail of the dot separated name from root_time to leaf matches the specified path_tail.

Parameters
root_timera Timer value of the root to begin search.
path_taila std::string const reference to the dot separated tail to match.
found_timera std::vector<Timer> reference to the vector to store matching timers.
Returns
a std::vector<Timer> reference to found_timer.

Definition at line 420 of file Timer.cpp.


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