Timer

class Timer

Public Functions

int add(const std::string &name)

Add a new profile name. Return the index.

void start(const int index)

Set the profile to the index and record the time. When a new index is started, or timer is ended, then the elapsed time is recorded.

void end()

End the current timer. Record previous index if exists.

clock_t sum_clocks() const

Return the sum of clock ticks.

clock_t clocks(const int index) const

Return the number of clock ticks for an index.

double hours(const int index) const

Return the total CPU hours of the index.

double hours(const std::string name) const

Return the total CPU hours of the name.

double hours() const

Return the total CPU hours of all indices.

double missing_percent(const std::string name, const Timer &timer) const

The total clocks in this timer for name should be the same as total clocks in timer for all names. Return the missing percent.