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
17
class
Timer
{
18
public
:
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
32
private
:
33
double
elapsed_m
;
34
timer_type
start_m
,
stop_m
;
35
};
36
37
#endif
Timer::duration_type
std::chrono::duration< double > duration_type
Definition
Timer.h:20
Timer::start
void start()
Definition
Timer.cpp:21
Timer::Timer
Timer()
Definition
Timer.cpp:13
Timer::stop
void stop()
Definition
Timer.cpp:25
Timer::clear
void clear()
Definition
Timer.cpp:17
Timer::stop_m
timer_type stop_m
Definition
Timer.h:34
Timer::elapsed
double elapsed()
Definition
Timer.cpp:36
Timer::enableFences
static bool enableFences
Definition
Timer.h:22
Timer::elapsed_m
double elapsed_m
Definition
Timer.h:33
Timer::start_m
timer_type start_m
Definition
Timer.h:34
Timer::timer_type
std::chrono::time_point< std::chrono::high_resolution_clock > timer_type
Definition
Timer.h:19