aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Haas <roland.haas@physics.gatech.edu>2011-08-10 07:33:18 -0400
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 19:54:48 +0000
commit38b3dcc7be02274ad45e35eebca36786711165c8 (patch)
tree4d3f079ec915676ee4e1ef14cbcdea4ea4fc5fbf
parentc6cfc65f560302fafabb180c3b83ec4bb3ca34be (diff)
Carpet: add consistency check when stopping hierarchical timers
* add warning to identify the faulty timer if a non-current timer is tried to be stopped * when stopping timer make sure it is the current one (by name)
-rw-r--r--Carpet/Carpet/src/TimerNode.cc4
-rw-r--r--Carpet/Carpet/src/Timers.cc7
2 files changed, 9 insertions, 2 deletions
diff --git a/Carpet/Carpet/src/TimerNode.cc b/Carpet/Carpet/src/TimerNode.cc
index 59e75a1d1..b081bee3e 100644
--- a/Carpet/Carpet/src/TimerNode.cc
+++ b/Carpet/Carpet/src/TimerNode.cc
@@ -92,7 +92,9 @@ namespace Carpet {
if(d_running)
{
// A timer can only be stopped if it is the current timer
- assert(this==d_current);
+ if(this != d_current)
+ CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Tried to stop non-current timer '%s'", getName().c_str());
timer->stop();
diff --git a/Carpet/Carpet/src/Timers.cc b/Carpet/Carpet/src/Timers.cc
index 4460c0eaa..585677388 100644
--- a/Carpet/Carpet/src/Timers.cc
+++ b/Carpet/Carpet/src/Timers.cc
@@ -50,7 +50,12 @@ namespace Carpet {
/// Stop the timer - it must be the most recently started timer
void Timer::stop ()
{
- TimerNode::getCurrentTimer()->stop();
+ TimerNode *current = TimerNode::getCurrentTimer();
+ if(current->getName() != name())
+ CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Trying to stop enclosing timer '%s' before enclosed time '%s'",
+ name().c_str(), current->getName().c_str());
+ current->stop();
}
/// Return the name of the timer