TimePeriod Class Reference

A named time period measurement with accumulation. More...

#include <common_time_period.h>

List of all members.

Public Member Functions

 TimePeriod (const char *name=NULL)
 Constructs internal structures and starts measuring.
const TimePeriodreset ()
 Resets accumulated time.
const TimePeriodtick_reset ()
 Starts a new period and resets accumulated time.
const TimePeriodtick (TimerPeriodTickType type=H2D_ACCUMULATE)
 Starts/ends a new period.
const std::string & name () const
 Returns a name of the time period if any.
double accumulated () const
 Returns accumulated time (in seconds).
std::string accumulated_str () const
 Returns accumulated time in human readable form.
double last () const
 Returns last measured period (in seconds).
std::string last_str () const
 Returns last measured period in human readable form.

Friends

H2D_API std::ofstream & operator<< (std::ofstream &stream, const TimePeriod &period)

Detailed Description

A named time period measurement with accumulation.

An instance of the timer should not be used across threads. The class is not thread-safe.

Todo:
Measure time that CPU spent on the task instead of a global time.

Constructor & Destructor Documentation

TimePeriod::TimePeriod ( const char *  name = NULL  ) 

Constructs internal structures and starts measuring.


Member Function Documentation

double TimePeriod::accumulated (  )  const [inline]

Returns accumulated time (in seconds).

std::string TimePeriod::accumulated_str (  )  const [inline]

Returns accumulated time in human readable form.

double TimePeriod::last (  )  const [inline]

Returns last measured period (in seconds).

Returns:
Returns the length of the last measured time period. -1 if period was skipped.
std::string TimePeriod::last_str (  )  const [inline]

Returns last measured period in human readable form.

const std::string& TimePeriod::name (  )  const [inline]

Returns a name of the time period if any.

const TimePeriod & TimePeriod::reset (  ) 

Resets accumulated time.

const TimePeriod & TimePeriod::tick ( TimerPeriodTickType  type = H2D_ACCUMULATE  ) 

Starts/ends a new period.

const TimePeriod & TimePeriod::tick_reset (  ) 

Starts a new period and resets accumulated time.


Friends And Related Function Documentation

H2D_API std::ofstream& operator<< ( std::ofstream &  stream,
const TimePeriod period 
) [friend]

The documentation for this class was generated from the following files:
Generated on Sat Jun 5 15:17:43 2010 for Hermes2D Library: Real Version by  doxygen 1.6.3