HermesCommon  3.0
Hermes::Mixins::TimeMeasurable Class Reference

Class using time measurement Can be used directly (is not abstract), so one can use e.g. this in a program: Mixins::TimeMeasurable time; time.tick(); <– do whatever you want to measure execution time of –> std::cout << "Whatever took " << time.last() << "seconds to execute.";. More...

#include <mixins.h>

+ Inheritance diagram for Hermes::Mixins::TimeMeasurable:

Public Types

enum  TimerPeriodTickType { HERMES_ACCUMULATE, HERMES_SKIP }
 Tick type. Used by the class Hermes::TimePeriod. More...
 

Public Member Functions

 TimeMeasurable (const char *name=nullptr)
 Constructs internal structures and starts measuring.
 
const TimeMeasurablereset ()
 Resets accumulated time.
 
const TimeMeasurabletick_reset ()
 Starts a new_ period and resets accumulated time.
 
const TimeMeasurabletick (TimeMeasurable::TimerPeriodTickType type=HERMES_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). More...
 
std::string last_str () const
 Returns last measured period in human readable form.
 

Detailed Description

Class using time measurement Can be used directly (is not abstract), so one can use e.g. this in a program: Mixins::TimeMeasurable time; time.tick(); <– do whatever you want to measure execution time of –> std::cout << "Whatever took " << time.last() << "seconds to execute.";.

Definition at line 183 of file mixins.h.

Member Function Documentation

double Hermes::Mixins::TimeMeasurable::last ( ) const

Returns last measured period (in seconds).

Returns
Returns the length of the last measured time period. -1 if period was skipped.

Definition at line 650 of file mixins.cpp.


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