timer.h
689 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
37
#ifndef GA_GPU_TIMER_H
#define GA_GPU_TIMER_H
#include <chrono>
//#include <thread>
//#include <iostream>
//using namespace std::chrono;
class Timer {
typedef std::chrono::high_resolution_clock Clock;
Clock::time_point epoch;
public:
void start(){
epoch = Clock::now();
}
Clock::duration time_elapsed() const{
return Clock::now() - epoch;
}
};
#endif
//class Timer {
// std::chrono::time_point<std::chrono::high_resolution_clock> epoch;
//
// public:
// typedef high_resolution_clock Clock;
// void start(){
// epoch = Clock::now();
// }
// std::chrono::time_point<std::chrono::high_resolution_clock> time_elapsed() const {
// return Clock::now() - epoch;
// }
//};