OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Timer.h
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 #ifndef TIMER_H
23 #define TIMER_H
24 
25 #include <boost/timer/timer.hpp>
26 
27 class Timer
28 {
29 public:
30 
31  Timer();
32 
33  void clear(); // Set all accumulated times to 0
34  void start(); // Start timer
35  void stop(); // Stop timer
36 
37  double clock_time(); // Report clock time accumulated in seconds
38  double user_time(); // Report user time accumlated in seconds
39  double system_time(); // Report system time accumulated in seconds
40  double cpu_time(); // Report total cpu_time which is just user_time + system_time
41 
42 private:
43  double wall_m;
44  double user_m;
45  double sys_m;
46  boost::timer::cpu_timer timer_m;
47 };
48 
49 #endif
Definition: Timer.h:28
boost::timer::cpu_timer timer_m
Definition: Timer.h:46
void start()
Definition: Timer.cpp:34
double user_time()
Definition: Timer.cpp:55
Timer()
Definition: Timer.cpp:24
void stop()
Definition: Timer.cpp:39
void clear()
Definition: Timer.cpp:29
double wall_m
Definition: Timer.h:43
double clock_time()
Definition: Timer.cpp:50
double user_m
Definition: Timer.h:44
double cpu_time()
Definition: Timer.cpp:65
double system_time()
Definition: Timer.cpp:60
double sys_m
Definition: Timer.h:45