IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
Timer.cpp
Go to the documentation of this file.
1
//
2
// Class Timer
3
// This class is used in IpplTimings.
4
//
5
//
6
//
7
#include "Kokkos_Core.hpp"
8
9
#include "
Timer.h
"
10
11
bool
Timer::enableFences
=
IPPL_ENABLE_TIMER_FENCES
;
12
13
Timer::Timer
() {
14
this->
clear
();
15
}
16
17
void
Timer::clear
() {
18
elapsed_m
= 0.0;
19
}
20
21
void
Timer::start
() {
22
start_m
= std::chrono::high_resolution_clock::now();
23
}
24
25
void
Timer::stop
() {
26
if
(
enableFences
) {
27
Kokkos::fence();
28
}
29
stop_m
= std::chrono::high_resolution_clock::now();
30
31
duration_type
elapsed
=
stop_m
-
start_m
;
32
33
elapsed_m
+=
elapsed
.count();
34
}
35
36
double
Timer::elapsed
() {
37
return
elapsed_m
;
38
}
Timer.h
IPPL_ENABLE_TIMER_FENCES
#define IPPL_ENABLE_TIMER_FENCES
Definition
Timer.h:12
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