7 #ifndef GRAPHGEN_PERFORMANCE_EVALUATOR_H_
8 #define GRAPHGEN_PERFORMANCE_EVALUATOR_H_
14 using hrc = std::chrono::high_resolution_clock;
15 using tp = hrc::time_point;
28 auto cur = hrc::now();
29 auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(cur - last_).count();
30 double t =
static_cast<double>(duration);
36 void reset() { counter_.total = 0; }
37 double last()
const {
return counter_.last; }
38 double total()
const {
return counter_.total; }
40 void store(
const std::string& s,
double time ) {
41 counters_[s].last = time;
42 counters_[s].total += time;
44 double get(
const std::string& s) {
45 return counters_.at(s).last;
47 bool find(
const std::string& s) {
48 return counters_.find(s) != counters_.end();
53 std::map<std::string, Elapsed> counters_;