blob: c198d90143939e61d6d21d52bd44eacc306f82b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#ifndef CACTUSTIMER_HH
#define CACTUSTIMER_HH
#include <cctk.h>
#include <iostream>
#include <list>
#include <string>
#include <utility>
#include <vector>
namespace Timers {
/** The CactusTimer class wraps the Cactus timer mechanism. All
times are returned as doubles for now. */
class CactusTimer {
int handle;
bool running;
public:
/// Create a new Cactus timer with the given name
CactusTimer(std::string timername);
/// Destruct the timer
~CactusTimer();
/// Start the timer
void start();
/// Stop the timer
void stop();
/// Reset the timer
void reset();
/// Timer name
std::string name() const;
/// Return the current time of the timer in seconds as a double
double getTime();
/// Return the average and maximum current time over all MPI processes
void getGlobalTime(double& avg, double& max);
/// Return all clock names and their units
std::vector<std::pair<std::string,std::string> > getAllTimerNames() const;
/// Return all clock values of the timer as double
std::vector<double> getAllTimerValues();
/// Print timer data
void printData ();
std::ostream& serialise(std::ostream &os);
private:
// Output (debug) messages that a timer is starting or stopping
void msgStart() const;
void msgStop() const;
};
} // namespace Timers
#endif // CACTUSTIMER_HH
|