13 currentStarts.clear();
20 currentStarts[tag] = Clock::now();
28 auto it = currentStarts.find(tag);
29 if (it == currentStarts.end())
37 Stats& stats = statsMap[tag];
40 stats.numExecutions++;
42 stats.latestExecutionTime = elapsed;
43 stats.averageExecutionTime = stats.totalExecutionTime / stats.numExecutions;
57 os <<
"Total number of executions: " << stats.numExecutions << std::endl;
58 os <<
"Average execution time: " << stats.averageExecutionTime.count() <<
" seconds"
66 for (
auto it : stats.statsMap)
68 os <<
"== Stats for '" << it.first <<
"' ==" << std::endl;
Duration totalExecutionTime
const Stats & getStats(const std::string &tag)
void stop(const std::string &tag)
void start(const std::string &tag)
std::ostream & operator<<(std::ostream &os, const Stats &stats)
std::chrono::duration< float > Duration
std::chrono::time_point< Clock > TimePoint