diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-10-21 15:43:14 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-10-21 15:43:14 +0000 |
commit | c34b8e460c6a370af274e9b45d344a4c29bd2664 (patch) | |
tree | 836c59a133985e064cfa72de71d9523e01f9fdf6 /src | |
parent | 555ff0dd99d1d42e1169516733e79e12e37d22d6 (diff) |
Timers are now created and timer data collected for scheduled routines.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1080 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r-- | src/include/CactusTimers.h | 1 | ||||
-rw-r--r-- | src/main/DefaultTimers.c | 16 | ||||
-rw-r--r-- | src/main/ScheduleInterface.c | 15 |
3 files changed, 32 insertions, 0 deletions
diff --git a/src/include/CactusTimers.h b/src/include/CactusTimers.h index 31d4c9bc..8d38f920 100644 --- a/src/include/CactusTimers.h +++ b/src/include/CactusTimers.h @@ -34,6 +34,7 @@ extern "C" { #endif int CCTK_TimerRegister(const char *name, t_TimerFuncs *functions); +int CCTK_TimerCreate(const char *name); void CCTK_TimerDestroy(const char *name); void CCTK_TimerDestroyI(int this_timer); void CCTK_TimerStart(const char *name); diff --git a/src/main/DefaultTimers.c b/src/main/DefaultTimers.c index e20ce65b..7dafec57 100644 --- a/src/main/DefaultTimers.c +++ b/src/main/DefaultTimers.c @@ -9,6 +9,7 @@ static char *rcsid = "$Header$"; +#include <stdio.h> #include <stdlib.h> #include "config.h" @@ -163,6 +164,9 @@ void CCTKi_TimerGetTimeOfDayStart(int timernum, t_GetTimeOfDayTimer *data) data->last = tp.tv_sec + (double)tp.tv_usec/1000000.0; +#ifdef DEBUG_TIMERS + printf("Starting gettimeofday timer %d\n", timernum); +#endif } /*@@ @@ -188,6 +192,9 @@ void CCTKi_TimerGetTimeOfDayStop(int timernum, t_GetTimeOfDayTimer *data) data->total += (tp.tv_sec + (double)tp.tv_usec/1000000.0 - data->last); +#ifdef DEBUG_TIMERS + printf("Stopping gettimeofday timer %d\n", timernum); +#endif } /*@@ @@ -278,6 +285,7 @@ void CCTKi_RegisterTimersGetTimeOfDay(void) functions.get = CCTKi_TimerGetTimeOfDayGet; functions.set = CCTKi_TimerGetTimeOfDaySet; + CCTK_TimerRegister("GetrUsage", &functions); } #endif /* HAVE_TIME_GETTIMEOFDAY */ @@ -372,6 +380,9 @@ void CCTKi_TimerGetrUsageStart(int timernum, t_GetrUsageTimer *data) data->last = ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec/1000000.0; +#ifdef DEBUG_TIMERS + printf("Starting getrusage timer %d\n", timernum); +#endif } /*@@ @@ -396,6 +407,9 @@ void CCTKi_TimerGetrUsageStop(int timernum, t_GetrUsageTimer *data) data->total += (ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec/1000000.0 - data->last); +#ifdef DEBUG_TIMERS + printf("Starting getrusage timer %d\n", timernum); +#endif } /*@@ @@ -486,6 +500,8 @@ void CCTKi_RegisterTimersGetrUsage(void) functions.get = CCTKi_TimerGetrUsageGet; functions.set = CCTKi_TimerGetrUsageSet; + CCTK_TimerRegister("GetrUsage", &functions); + } #endif /* HAVE_TIME_GETRUSAGE */ diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c index afa039f5..89224275 100644 --- a/src/main/ScheduleInterface.c +++ b/src/main/ScheduleInterface.c @@ -27,6 +27,8 @@ static char *rcsid = "$Header$"; #include "cctk_FortranWrappers.h" +#include "CactusTimers.h" + /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ @@ -57,6 +59,10 @@ typedef struct int n_trigger_groups; int *trigger_groups; + /* Timer data */ + + int timer_handle; + /* Dynamic data */ int *CommOnEntry; int *StorageOnEntry; @@ -125,6 +131,7 @@ static int *scheduled_comm_groups = NULL; static int n_scheduled_storage_groups = 0; static int *scheduled_storage_groups = NULL; +static int n_schedule_timers = 0; /******************************************************************** ********************* External Routines ********************** @@ -494,6 +501,7 @@ static t_attribute *CreateAttribute(const char *description, va_list *ap) { t_attribute *this; + char timerid[20]; this = (t_attribute *)malloc(sizeof(t_attribute)); @@ -540,6 +548,10 @@ static t_attribute *CreateAttribute(const char *description, this->n_comm_groups = n_comm_groups; this->n_trigger_groups = n_trigger_groups; + /* Add a timer to the item */ + + sprintf(timerid,"schedule_%d", n_schedule_timers++); + this->timer_handle = CCTK_TimerCreate(timerid); } else { @@ -1013,6 +1025,7 @@ static int CCTKi_ScheduleCallFunction(void *function, void (*calledfunc)(void *); + CCTK_TimerStartI(attribute->timer_handle); if(attribute->language == lang_fortran) { /* Call the fortran wrapper. */ @@ -1027,6 +1040,8 @@ static int CCTKi_ScheduleCallFunction(void *function, calledfunc(data->GH); } + CCTK_TimerStopI(attribute->timer_handle); + return 1; } |