IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
Timer.h
1//
2// Class Timer
3// This class is used in IpplTimings.
4//
5//
6//
7#ifndef IPPL_TIMER_H
8#define IPPL_TIMER_H
9
10#ifndef IPPL_ENABLE_TIMER_FENCES
11#warning "IPPL timer fences were not set via CMake! Defaulting to no fences."
12#define IPPL_ENABLE_TIMER_FENCES false
13#endif
14
15#include <chrono>
16
17class Timer {
18public:
19 using timer_type = std::chrono::time_point<std::chrono::high_resolution_clock>;
20 using duration_type = std::chrono::duration<double>;
21
22 static bool enableFences;
23
24 Timer();
25
26 void clear(); // Set all accumulated times to 0
27 void start(); // Start timer
28 void stop(); // Stop timer
29
30 double elapsed(); // Report clock time accumulated in seconds
31
32private:
33 double elapsed_m;
34 timer_type start_m, stop_m;
35};
36
37#endif
Definition Timer.h:17