aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/CactusTimer.hh
blob: 071ffc9ac2167f9ef0439001f17f09a01b507399 (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
#ifndef CACTUSTIMER_HH
#define CACTUSTIMER_HH

#include <iostream>
#include <list>
#include <string>
#include <cctk.h>

namespace Carpet {

  using namespace std;

/** 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 (const string &timername);

    /// Destroy a timer
    ~CactusTimer ();

    /// Start the timer
    void start ();

    /// Stop the timer
    void stop ();

    /// Reset the timer
    void reset ();

    /// Timer name
    string name () const;

    /// Print timer data
    void printData ();

    /// Return the current time of the timer as a double
    double getTime();

    ostream& serialise(ostream &os);

  private:

    // Output (debug) messages that a timer is starting or stopping
    void
    msgStart ()
      const;

    void
    msgStop ()
      const;

  };
}  // namespace Carpet

#endif // CACTUSTIMER_HH