From c1ee98289170c1bc140fb3519580c9f7eceb8baf Mon Sep 17 00:00:00 2001 From: knarf Date: Wed, 24 Oct 2012 20:03:13 +0000 Subject: Added CCTK_TimerRunning and CCTK_TimerRunningI These functions return whether a Cactus timer is running or not (either by name or by handle). git-svn-id: http://svn.cactuscode.org/flesh/trunk@4890 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/main/ScheduleInterface.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c index 5f549dc1..e267e0b4 100644 --- a/src/main/ScheduleInterface.c +++ b/src/main/ScheduleInterface.c @@ -1253,13 +1253,20 @@ int CCTK_SchedulePrintTimesToFile(const char *where, FILE *file) /* also print total time at the bottom */ if (total_timer >= 0) { - CCTK_TimerStopI (total_timer); + int total_timer_running = CCTK_TimerIsRunningI(total_timer); + if (total_timer_running) + { + CCTK_TimerStopI (total_timer); + } CCTK_TimerI (total_timer, timerinfo); CCTKi_SchedulePrintTimerInfo (timerinfo, NULL, "", "Total time for simulation", file); /* just in case this is not at termination yet ... */ - CCTK_TimerStartI (total_timer); + if (total_timer_running) + { + CCTK_TimerStartI (total_timer); + } } return 0; -- cgit v1.2.3