MPQC  3.0.0-alpha
sc::Timer Class Reference

The Timer class uses RegionTimer to time intervals in an exception safe manner. More...

#include <util/misc/regtime.h>

Public Member Functions

 Timer (const char *name)
 Start timing a region using the default RegionTimer and activate the timer. More...
 
 Timer (const std::string &name)
 Start timing a region using the default RegionTimer.
 
 Timer (const Ref< RegionTimer > &, const char *name)
 Start timing a region using the given RegionTimer. More...
 
 Timer (const Ref< RegionTimer > &, const std::string &name)
 Start timing a region using the given RegionTimer.
 
 Timer (const Ref< RegionTimer > &)
 Construct a Timer object using the giving RegionTimer, but do not begin timing a region.
 
 Timer ()
 Construct a Timer object using the default RegionTimer and do not begin timing a region.
 
 ~Timer ()
 Stop timing a region, if active.
 
void print (std::ostream &=ExEnv::out0()) const
 Print the timings held by this object's RegionTimer.
 
DEPRECATED void reset (const char *=0)
 Stop timing the current region, if active. More...
 
void enter (const char *region)
 Begin timing, using the given timing region name. More...
 
void enter (const std::string &region)
 
void change (const char *region)
 Change the current timing region to the one specified by the given name.
 
void change (const std::string &region)
 
void exit (const char *region=0)
 Exit the current timing region. More...
 
void exit (const std::string &region)
 
void set_default (const char *region)
 Default timing regions are provided as a performance optimization. More...
 
void set_default (const std::string &r)
 
void unset_default ()
 
void enter_default ()
 
void exit_default ()
 
double cpu_time (const char *region) const
 Query the timers and flop counter for the region.
 
double cpu_time (const std::string &region) const
 
double wall_time (const char *region) const
 
double wall_time (const std::string &region) const
 
double flops (const char *region) const
 
double flops (const std::string &region) const
 

Detailed Description

The Timer class uses RegionTimer to time intervals in an exception safe manner.

It will automatically call RegionTimer::enter when its constructor is called and RegionTimer::exit when its destructor is called. The reset member can also result in RegionTimer's enter and exit routines being called. The programmer is responsible for making sure that timers are exited in the reverse of the order that they are entered.

Constructor & Destructor Documentation

◆ Timer() [1/2]

sc::Timer::Timer ( const char *  name)

Start timing a region using the default RegionTimer and activate the timer.

If a null name pointer is given, then the timer will not be activated.

◆ Timer() [2/2]

sc::Timer::Timer ( const Ref< RegionTimer > &  ,
const char *  name 
)

Start timing a region using the given RegionTimer.

If a null name pointer is given, then the timer will not be activated.

Member Function Documentation

◆ enter()

void sc::Timer::enter ( const char *  region)

Begin timing, using the given timing region name.

Nested regions are supported. That is, after a region is entered, another may be entered before the first is exited. The time for the nested region is included in the time for the containing region.

Referenced by sc::sma2::Array< 6 >::parallel_accumulate(), sc::sma2::Array< 6 >::parallel_union(), and sc::sma2::Array< 6 >::replicated_from_distributed().

◆ exit()

void sc::Timer::exit ( const char *  region = 0)

◆ reset()

DEPRECATED void sc::Timer::reset ( const char *  = 0)

Stop timing the current region, if active.

If a new region name is passed in, start timing with that name. If no region name is given, the Timer will be deactivated. This member is deprecated.

◆ set_default()

void sc::Timer::set_default ( const char *  region)

Default timing regions are provided as a performance optimization.

The set_default member is used to specify the default region. Timing is begun with enter_default, which does not need to lookup the region as the enter member must do. Timing is stopped with exit_default. Default regions can be nested, and unset_default restores the default in effect before the previous set_default call.

Referenced by sc::R12IntEval::contract_tbint_tensors_to_obtensor().


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

Generated at Sun Jan 26 2020 23:24:13 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.