OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ippl
src
Utility
Timer.cpp
Go to the documentation of this file.
1
//
2
// Class Timer
3
// This class is used in IpplTimings.
4
// https://www.boost.org/doc/libs/1_70_0/libs/timer/doc/cpu_timers.html
5
//
6
// Copyright (c) 2019, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
7
// All rights reserved
8
//
9
// Implemented as part of the PhD thesis
10
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
11
//
12
// This file is part of OPAL.
13
//
14
// OPAL is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU General Public License as published by
16
// the Free Software Foundation, either version 3 of the License, or
17
// (at your option) any later version.
18
//
19
// You should have received a copy of the GNU General Public License
20
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
21
//
22
#include "
Timer.h
"
23
24
Timer::Timer
() {
25
this->
clear
();
26
}
27
28
29
void
Timer::clear
() {
30
wall_m
=
user_m
=
sys_m
= 0.0;
31
}
32
33
34
void
Timer::start
() {
35
timer_m
.start();
36
}
37
38
39
void
Timer::stop
() {
40
timer_m
.stop();
41
42
boost::timer::cpu_times elapsed =
timer_m
.elapsed();
43
44
wall_m
+= elapsed.wall;
45
user_m
+= elapsed.user;
46
sys_m
+= elapsed.system;
47
}
48
49
50
double
Timer::clock_time
() {
51
return
wall_m
* 1.0e-9;
52
}
53
54
55
double
Timer::user_time
() {
56
return
user_m
* 1.0e-9;
57
}
58
59
60
double
Timer::system_time
() {
61
return
sys_m
* 1.0e-9;
62
}
63
64
65
double
Timer::cpu_time
() {
66
return
(
user_m
+
sys_m
) * 1.0e-9;
67
}
Timer::system_time
double system_time()
Definition:
Timer.cpp:60
Timer::start
void start()
Definition:
Timer.cpp:34
Timer::Timer
Timer()
Definition:
Timer.cpp:24
Timer::timer_m
boost::timer::cpu_timer timer_m
Definition:
Timer.h:46
Timer.h
Timer::user_time
double user_time()
Definition:
Timer.cpp:55
Timer::clock_time
double clock_time()
Definition:
Timer.cpp:50
Timer::cpu_time
double cpu_time()
Definition:
Timer.cpp:65
Timer::wall_m
double wall_m
Definition:
Timer.h:43
Timer::stop
void stop()
Definition:
Timer.cpp:39
Timer::user_m
double user_m
Definition:
Timer.h:44
Timer::sys_m
double sys_m
Definition:
Timer.h:45
Timer::clear
void clear()
Definition:
Timer.cpp:29
Generated on Tue Jul 2 2024 15:05:27 for OPAL (Object Oriented Parallel Accelerator Library) by
1.8.5