OPAL (Object Oriented Parallel Accelerator Library)
2024.2
OPAL
ippl
src
Utility
Timer.h
Go to the documentation of this file.
1
//
2
// Class Timer
3
// This class is used in IpplTimings.
4
//
5
// Copyright (c) 2019, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
6
// All rights reserved
7
//
8
// Implemented as part of the PhD thesis
9
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
10
//
11
// This file is part of OPAL.
12
//
13
// OPAL is free software: you can redistribute it and/or modify
14
// it under the terms of the GNU General Public License as published by
15
// the Free Software Foundation, either version 3 of the License, or
16
// (at your option) any later version.
17
//
18
// You should have received a copy of the GNU General Public License
19
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20
//
21
#ifndef TIMER_H
22
#define TIMER_H
23
24
#include <chrono>
25
#include <ctime>
26
27
class
Timer
{
28
public
:
29
Timer
();
30
31
void
clear
();
// Set all accumulated times to 0
32
void
start
();
// Start timer
33
void
stop
();
// Stop timer
34
35
double
clock_time
();
// Report clock time accumulated in seconds
36
double
cpu_time
();
// Report total cpu_time which is just user_time + system_time
37
38
private
:
39
std::chrono::steady_clock::time_point
wall_start_m
;
40
std::clock_t
cpu_start_m
;
41
42
double
wall_m
;
43
double
cpu_m
;
44
};
45
46
#endif
Timer
Definition
Timer.h:27
Timer::start
void start()
Definition
Timer.cpp:32
Timer::cpu_m
double cpu_m
Definition
Timer.h:43
Timer::Timer
Timer()
Definition
Timer.cpp:23
Timer::stop
void stop()
Definition
Timer.cpp:37
Timer::clear
void clear()
Definition
Timer.cpp:27
Timer::cpu_start_m
std::clock_t cpu_start_m
Definition
Timer.h:40
Timer::wall_m
double wall_m
Definition
Timer.h:42
Timer::clock_time
double clock_time()
Definition
Timer.cpp:48
Timer::cpu_time
double cpu_time()
Definition
Timer.cpp:52
Timer::wall_start_m
std::chrono::steady_clock::time_point wall_start_m
Definition
Timer.h:39
Generated on Wed Sep 30 2026 07:14:52 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.8