IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
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;
35};
36
37#endif
std::chrono::duration< double > duration_type
Definition Timer.h:20
void start()
Definition Timer.cpp:21
Timer()
Definition Timer.cpp:13
void stop()
Definition Timer.cpp:25
void clear()
Definition Timer.cpp:17
timer_type stop_m
Definition Timer.h:34
double elapsed()
Definition Timer.cpp:36
static bool enableFences
Definition Timer.h:22
double elapsed_m
Definition Timer.h:33
timer_type start_m
Definition Timer.h:34
std::chrono::time_point< std::chrono::high_resolution_clock > timer_type
Definition Timer.h:19