diff options
Diffstat (limited to 'Carpet/Carpet/src/Timers.hh')
-rw-r--r-- | Carpet/Carpet/src/Timers.hh | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Carpet/Carpet/src/Timers.hh b/Carpet/Carpet/src/Timers.hh index 2c2543168..af887cb69 100644 --- a/Carpet/Carpet/src/Timers.hh +++ b/Carpet/Carpet/src/Timers.hh @@ -1,6 +1,7 @@ +#include <iostream> #include <list> -#include "cctk.h" +#include <cctk.h> @@ -79,6 +80,7 @@ namespace Carpet { void start () { + msgStart (); running = true; CCTK_TimerStartI (handle); } @@ -89,6 +91,7 @@ namespace Carpet { { CCTK_TimerStopI (handle); running = false; + msgStop (); } // Reset the timer @@ -107,6 +110,32 @@ namespace Carpet { void printData (); + private: + + // Output (debug) messages that a timer is starting or stopping + void + msgStart () + const; + + void + msgStop () + const; + }; + + + // Macros for using timers in a convenient manner + +#define TIMING_BEGIN(name) \ + { \ + static Carpet::Timer timer (name); \ + timer.start(); \ + { + +#define TIMING_END \ + } \ + timer.stop(); \ +} while (0) + } // namespace Carpet |