forked from kevinlin311tw/Caffe-DeepBinaryCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark.hpp
More file actions
40 lines (31 loc) · 814 Bytes
/
benchmark.hpp
File metadata and controls
40 lines (31 loc) · 814 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
38
39
40
#ifndef CAFFE_UTIL_BENCHMARK_H_
#define CAFFE_UTIL_BENCHMARK_H_
#include <boost/date_time/posix_time/posix_time.hpp>
#include "caffe/util/device_alternate.hpp"
namespace caffe {
class Timer {
public:
Timer();
virtual ~Timer();
void Start();
void Stop();
float MilliSeconds();
float Seconds();
inline bool initted() { return initted_; }
inline bool running() { return running_; }
inline bool has_run_at_least_once() { return has_run_at_least_once_; }
protected:
void Init();
bool initted_;
bool running_;
bool has_run_at_least_once_;
#ifndef CPU_ONLY
cudaEvent_t start_gpu_;
cudaEvent_t stop_gpu_;
#endif
boost::posix_time::ptime start_cpu_;
boost::posix_time::ptime stop_cpu_;
float elapsed_milliseconds_;
};
} // namespace caffe
#endif // CAFFE_UTIL_BENCHMARK_H_