From b65d0242a9ff9d968a30d04e23b92ec0ed531aee Mon Sep 17 00:00:00 2001 From: schnetter Date: Sun, 16 May 2004 14:48:28 +0000 Subject: Remove triggervar. Do not register an I/O method because this is not necessary. Check the output condition in the output routine. git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/TimerReport/trunk@8 d0051148-8e13-4bef-be1d-f6c572c85f9f --- interface.ccl | 8 ----- schedule.ccl | 5 --- src/Output.c | 111 ++++++++++++---------------------------------------------- 3 files changed, 22 insertions(+), 102 deletions(-) diff --git a/interface.ccl b/interface.ccl index 47dd0db..64d47a4 100644 --- a/interface.ccl +++ b/interface.ccl @@ -2,11 +2,3 @@ # $Header$ implements: timerreport -inherits: - -private: - -int triggergroup type=SCALAR -{ - triggervar -} "For triggering output" diff --git a/schedule.ccl b/schedule.ccl index 3a40bff..fee2fd7 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -2,11 +2,6 @@ # $Header$ -SCHEDULE TimerReport_Startup AT CCTK_STARTUP -{ - LANG: C -} "Startup routine" - SCHEDULE TimerReport_Output AS zzz_TimerReport_Output AT CCTK_ANALYSIS { LANG: C diff --git a/src/Output.c b/src/Output.c index fcb39c7..3854f92 100644 --- a/src/Output.c +++ b/src/Output.c @@ -3,11 +3,13 @@ @date July 6 2003 @author Gabrielle Allen @desc - Functions to deal with making TimerReport an IO method + Functions to report the timers @enddesc @version $Id$ @@*/ +#include + #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_Arguments.h" @@ -26,8 +28,6 @@ CCTK_FILEVERSION(CactusUtils_TimerReport_Output_c) ********************* Local Routine Prototypes ********************* ********************************************************************/ -int TimerReport_TimeForOutput (const cGH *GH, int vindex); - /******************************************************************** ********************* Other Routine Prototypes ********************* ********************************************************************/ @@ -40,84 +40,10 @@ int TimerReport_TimeForOutput (const cGH *GH, int vindex); ******************** External Routines ************************ ********************************************************************/ -void TimerReport_Startup (void); - - - /*@@ - @routine TimerReport_Startup - @date Sun 6th July 2003 - @author Gabrielle Allen - @desc - The startup registration routine for TimerReport. - Registers TimerReport as an IO Method and provide the - only necessary method TimeForOutput - @enddesc - @calls CCTK_RegisterGHExtensionSetupGH -@@*/ -void TimerReport_Startup (void) -{ - int handle; - - handle = CCTK_RegisterIOMethod ("TimerReport"); - CCTK_RegisterIOMethodTimeToOutput (handle, TimerReport_TimeForOutput); -} - - /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ -int TimerReport_TimeForOutput (const cGH *GH, int vindex); - - /*@@ - @routine TimerReport_TimeForOutput - @date July 6 2003 - @author Gabrielle Allen - @desc - Decides if it is time to output timer information - @enddesc - @calls CheckSteerableParameters - - @var GH - @vdesc Pointer to CCTK GH - @vtype const cGH * - @vio in - @endvar - @var vindex - @vdesc index of variable to check for output - @vtype int - @vio in - @endvar - - @returntype int - @returndesc - true/false (1 or 0) if analysis should be called - @endreturndesc -@@*/ -int TimerReport_TimeForOutput (const cGH *GH, int vindex) -{ - DECLARE_CCTK_PARAMETERS - - int retval=0; - - if (vindex==CCTK_VarIndex("timerreport::triggervar")) - { - if (next || out_at == GH->cctk_iteration) - { - retval = 1; - } - else if (out_every) - { - if (GH->cctk_iteration%out_every == 0) - { - retval = 1; - } - } - } - - return retval; -} - /*@@ @routine TimerReport_Output @date July 6 2003 @@ -129,17 +55,23 @@ int TimerReport_TimeForOutput (const cGH *GH, int vindex) @@*/ void TimerReport_Output(CCTK_ARGUMENTS) { - DECLARE_CCTK_ARGUMENTS - DECLARE_CCTK_PARAMETERS - - CCTK_SchedulePrintTimes(NULL); + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; - if (next) + if (next || out_at == cctk_iteration || cctk_iteration%out_every == 0) { - CCTK_ParameterSet("next", CCTK_THORNSTRING, "no"); - } - return; + CCTK_VInfo(CCTK_THORNSTRING, + "Timer Report at iteration %d time %g", + cctk_iteration, (double)cctk_time); + CCTK_SchedulePrintTimes(NULL); + + if (next) + { + CCTK_ParameterSet("next", CCTK_THORNSTRING, "no"); + } + + } } /*@@ @@ -153,13 +85,14 @@ void TimerReport_Output(CCTK_ARGUMENTS) @@*/ void TimerReport_Checkpoint(CCTK_ARGUMENTS) { - DECLARE_CCTK_ARGUMENTS - DECLARE_CCTK_PARAMETERS + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; if (before_checkpoint) { + CCTK_VInfo(CCTK_THORNSTRING, + "Timer Report before checkpointing at iteration %d, time %g", + cctk_iteration, (double)cctk_time); CCTK_SchedulePrintTimes(NULL); } - - return; } -- cgit v1.2.3