WarpX
Timer.H
Go to the documentation of this file.
1 /* Copyright 2023 Luca Fedeli
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 
8 #ifndef ABLASTR_TIMER_H_
9 #define ABLASTR_TIMER_H_
10 
12 {
13 
19  class Timer
20  {
21  public:
22 
26  Timer() = default;
27 
28 
32  void record_start_time() noexcept;
33 
34 
38  void record_stop_time() noexcept;
39 
40 
47  [[nodiscard]] double get_duration () const noexcept;
48 
49 
56  [[nodiscard]] double get_global_duration () const;
57 
58  private:
59 
60  double m_start_time ;
61  double m_stop_time ;
62  };
63 
64 }
65 
66 #endif //ABLASTR_TIMER_H_
Definition: Timer.H:20
double get_global_duration() const
This collective function returns the maximum duration recorded across all the MPI ranks (in seconds).
Definition: Timer.cpp:33
void record_stop_time() noexcept
This function records the stop time.
Definition: Timer.cpp:21
double m_stop_time
Definition: Timer.H:61
double m_start_time
Definition: Timer.H:60
double get_duration() const noexcept
This function returns the duration, calculated as the difference between the stop time and the start ...
Definition: Timer.cpp:27
void record_start_time() noexcept
This function records the start time.
Definition: Timer.cpp:15
Timer()=default
The constructor.
Definition: Timer.H:12