-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.h
More file actions
36 lines (27 loc) · 789 Bytes
/
timer.h
File metadata and controls
36 lines (27 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// Created by Erin M Gunn on 1/17/21.
//
#ifndef RADTREE_TIMER_H
#define RADTREE_TIMER_H
#include <chrono>
#include <iostream>
#include <iomanip>
namespace TIMER {
namespace {
static std::chrono::time_point<std::chrono::steady_clock> time_stamp;
}
inline void START(const std::string& msg) {
std::cout << "====================\n";
std::cout << "Benchmark: " << msg << '\n';
time_stamp = std::chrono::steady_clock::now();
}
inline void START() {
return START("");
}
inline void STOP() {
std::chrono::duration<double, std::milli> elapsed = std::chrono::steady_clock::now() - time_stamp;
std::cout << "Time: " << std::fixed << std::setprecision(4) << elapsed.count() << " ms\n";
std::cout << "--------------------\n";
}
}
#endif //RADTREE_TIMER_H