summaryrefslogtreecommitdiff
path: root/src/main/DefaultTimers.c
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-10-31 17:21:45 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-10-31 17:21:45 +0000
commit3a29425a04b8b869d4e2f3149ab286560a9963d6 (patch)
tree2c364c1048bf2cbb6bf9f50251792b422f085389 /src/main/DefaultTimers.c
parent133ed04f8a7414d2014bea2d74c7288ff3ea7f8b (diff)
Pass NULL instead of a 'struct timezone *' pointer as second argument to
gettimeofday(2). The timezone structure is obsolete and not even defined anymore when compiling with gcc and '-ansi'. Also did some reformatting and completed grdoc. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3018 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/DefaultTimers.c')
-rw-r--r--src/main/DefaultTimers.c722
1 files changed, 279 insertions, 443 deletions
diff --git a/src/main/DefaultTimers.c b/src/main/DefaultTimers.c
index 6ee857e4..34672715 100644
--- a/src/main/DefaultTimers.c
+++ b/src/main/DefaultTimers.c
@@ -1,11 +1,11 @@
- /*@@
+/*@@
@file DefaultTimers.c
@date Wed Oct 20 16:17:42 1999
@author Tom Goodale
- @desc
- Default Cactus timers
- @enddesc
- @version $Header$
+ @desc
+ Default Cactus timers
+ @enddesc
+ @version $Id$
@@*/
#include <stdio.h>
@@ -20,13 +20,19 @@
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
-# else
-# if HAVE_TIME_H
-# include <time.h>
-# endif
+# elif HAVE_TIME_H
+# include <time.h>
# endif
#endif
+#ifdef HAVE_TIME_GETTIMEOFDAY
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_TIME_GETRUSAGE
+#include <sys/resource.h>
+#endif
+
#include "cctk_Timers.h"
static const char *rcsid = "$Header$";
@@ -37,13 +43,29 @@ CCTK_FILEVERSION(main_DefaultTimers_c)
/********************************************************************
********************* Local Data Types ***********************
********************************************************************/
+#ifdef HAVE_TIME_GETTIMEOFDAY
+/* A structure to hold the relevent data */
+typedef struct
+{
+ struct timeval total;
+ struct timeval last;
+} t_GetTimeOfDayTimer;
+#endif
+
+#ifdef HAVE_TIME_GETRUSAGE
+/* A structure to hold the relevent data */
+typedef struct
+{
+ struct timeval total;
+ struct timeval last;
+} t_GetrUsageTimer;
+#endif
+
/********************************************************************
********************* Local Routine Prototypes *********************
********************************************************************/
-
/* Prototypes for registration functions */
-
#ifdef HAVE_TIME_GETTIMEOFDAY
static void CCTKi_RegisterTimersGetTimeOfDay(void);
#endif
@@ -52,13 +74,20 @@ static void CCTKi_RegisterTimersGetTimeOfDay(void);
static void CCTKi_RegisterTimersGetrUsage(void);
#endif
-/********************************************************************
- ********************* Other Routine Prototypes *********************
- ********************************************************************/
/********************************************************************
********************* Local Data *****************************
********************************************************************/
+#ifdef HAVE_TIME_GETTIMEOFDAY
+static char *GetTimeOfDayHeading = "gettimeofday";
+static char *GetTimeOfDayUnits = "secs";
+#endif
+
+#ifdef HAVE_TIME_GETRUSAGE
+static char *GetrUsageHeading = "getrusage";
+static char *GetrUsageUnits = "secs";
+#endif
+
/********************************************************************
********************* External Routines **********************
@@ -70,25 +99,19 @@ int CCTKi_RegisterDefaultTimerFunctions(void);
@routine CCTKi_RegisterDefaultTimerFunctions
@date Wed Oct 20 18:27:20 1999
@author Tom Goodale
- @desc
-
- Master flesh timer registration function./
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @desc
+ Master flesh timer registration function.
+ @enddesc
+ @calls CCTKi_RegisterTimersGetTimeOfDay
+ CCTKi_RegisterTimersGetrUsage
@returntype int
- @returndesc
- 0
+ @returndesc
+ 0
@endreturndesc
@@*/
int CCTKi_RegisterDefaultTimerFunctions(void)
{
-
#ifdef HAVE_TIME_GETTIMEOFDAY
CCTKi_RegisterTimersGetTimeOfDay();
#endif
@@ -97,113 +120,74 @@ int CCTKi_RegisterDefaultTimerFunctions(void)
CCTKi_RegisterTimersGetrUsage();
#endif
- return 0;
-}
+ return (0);
+}
/********************************************************************
********************* Local Routines *************************
********************************************************************/
-
-
-/*********************************************************************
- **************** Actual timers *********************
- *********************************************************************/
-
-
-
/*********************************************************************
**************** gettimeofday based timer *********************
*********************************************************************/
#ifdef HAVE_TIME_GETTIMEOFDAY
-#include <unistd.h>
-
-/* A structure to hold the relevent data */
-typedef struct
-{
- struct timeval total;
- struct timeval last;
-} t_GetTimeOfDayTimer;
-
-static char *GetTimeOfDayHeading = "gettimeofday";
-static char *GetTimeOfDayUnits = "secs";
-
/*@@
- @routine CCTKi_TimerGetTimeOfDayCreate
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Create the timer structure for use with the gettimeofday function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetTimeOfDayCreate
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Create the timer structure for use with the gettimeofday function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@returntype void *
- @returndesc
- timer structure
+ @returndesc
+ timer structure, or NULL if allocation failed
@endreturndesc
@@*/
static void *CCTKi_TimerGetTimeOfDayCreate(int timernum)
{
- t_GetTimeOfDayTimer *this;
+ t_GetTimeOfDayTimer *retval;
- timernum = timernum;
- this = malloc(sizeof(t_GetTimeOfDayTimer));
+ (void) (timernum + 0);
- if(this)
- {
- this->total.tv_sec = 0;
- this->total.tv_usec = 0;
- }
+ retval = calloc (1, sizeof (t_GetTimeOfDayTimer));
- return this;
+ return (retval);
}
+
/*@@
- @routine CCTKi_TimerGetTimeOfDayDestroy
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Destroy the timer structure for use with the gettimeofday function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetTimeOfDayDestroy
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Destroy the timer structure for use with the gettimeofday function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var data
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetTimeOfDayDestroy(int timernum, void *data)
{
- timernum = timernum;
+ (void) (timernum + 0);
if(data)
{
free(data);
@@ -212,254 +196,197 @@ static void CCTKi_TimerGetTimeOfDayDestroy(int timernum, void *data)
/*@@
- @routine CCTKi_TimerGetTimeOfDayStart
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Start the timer with the gettimeofday function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetTimeOfDayStart
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Start the timer with the gettimeofday function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetTimeOfDayStart(int timernum, void *idata)
{
+ struct timeval tp;
t_GetTimeOfDayTimer *data;
- struct timeval tp;
- struct timezone tzp;
- timernum = timernum;
- data = (t_GetTimeOfDayTimer *)idata;
+ (void) (timernum + 0);
- gettimeofday(&tp, &tzp);
+ gettimeofday(&tp, NULL);
+ data = (t_GetTimeOfDayTimer *) idata;
data->last = tp;
-
-#ifdef DEBUG_TIMERS
- printf("Starting gettimeofday timer %d\n", timernum);
-#endif
}
+
/*@@
- @routine CCTKi_TimerGetTimeOfDayStop
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Stop the timer with the gettimeofday function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetTimeOfDayStop
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Stop the timer with the gettimeofday function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetTimeOfDayStop(int timernum, void *idata)
{
- t_GetTimeOfDayTimer *data;
-
struct timeval tp;
- struct timezone tzp;
+ t_GetTimeOfDayTimer *data;
- timernum = timernum;
- data = (t_GetTimeOfDayTimer *)idata;
- gettimeofday(&tp, &tzp);
+ (void) (timernum + 0);
- data->total.tv_sec += (tp.tv_sec - data->last.tv_sec);
- data->total.tv_usec += (tp.tv_usec - data->last.tv_usec);
+ gettimeofday(&tp, NULL);
-#ifdef DEBUG_TIMERS
- printf("Stopping gettimeofday timer %d\n", timernum);
-#endif
+ data = (t_GetTimeOfDayTimer *) idata;
+ data->total.tv_sec += tp.tv_sec - data->last.tv_sec;
+ data->total.tv_usec += tp.tv_usec - data->last.tv_usec;
}
+
/*@@
- @routine CCTKi_TimerGetTimeOfDayReset
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Reset the timer with the gettimeofday function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetTimeOfDayReset
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Reset the timer with the gettimeofday function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetTimeOfDayReset(int timernum, void *idata)
{
t_GetTimeOfDayTimer *data;
- timernum = timernum;
- data = (t_GetTimeOfDayTimer *)idata;
- data->last.tv_sec = 0;
- data->last.tv_usec = 0;
- data->total.tv_sec = 0;
- data->total.tv_usec = 0;
+ (void) (timernum + 0);
+ data = (t_GetTimeOfDayTimer *) idata;
+ data->last.tv_sec = data->last.tv_usec = 0;
+ data->total.tv_sec = data->total.tv_usec = 0;
}
+
/*@@
- @routine CCTKi_TimerGetTimeOfDayGet
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Get the time recorded with the gettimeofday function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetTimeOfDayGet
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Get the time recorded with the gettimeofday function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
+ @endvar
@var vals
@vdesc Timer value structure
@vtype cTimerVal
@vio out
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetTimeOfDayGet(int timernum, void *idata, cTimerVal *vals)
{
t_GetTimeOfDayTimer *data;
- timernum = timernum;
- data = (t_GetTimeOfDayTimer *)idata;
+ (void) (timernum + 0);
+
+ data = (t_GetTimeOfDayTimer *) idata;
vals[0].type = val_double;
vals[0].heading = GetTimeOfDayHeading;
vals[0].units = GetTimeOfDayUnits;
vals[0].val.d = data->total.tv_sec + (double)data->total.tv_usec/1000000.0;
}
+
/*@@
- @routine CCTKi_TimerGetTimeOfDaySet
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Set the time for a gettimeofday function based timer.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetTimeOfDaySet
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Set the time for a gettimeofday function based timer.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
+ @endvar
@var vals
@vdesc Timer value structure
@vtype cTimerVal
@vio in
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetTimeOfDaySet(int timernum, void *idata, cTimerVal *vals)
{
t_GetTimeOfDayTimer *data;
- timernum = timernum;
- data = (t_GetTimeOfDayTimer *)idata;
- data->total.tv_sec = (long)vals[0].val.d;
- data->total.tv_usec = (long)(1000000*vals[0].val.d-data->total.tv_sec);
+ (void) (timernum + 0);
+
+ data = (t_GetTimeOfDayTimer *) idata;
+ data->total.tv_sec = vals[0].val.d;
+ data->total.tv_usec = 1000000*vals[0].val.d - data->total.tv_sec;
}
- /*@@
- @routine CCTKi_RegisterTimersGetTimeOfDay
- @date Wed Oct 20 18:32:17 1999
- @author Tom Goodale
- @desc
- Register all the timer functions associated with the gettimeofday function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ /*@@
+ @routine CCTKi_RegisterTimersGetTimeOfDay
+ @date Wed Oct 20 18:32:17 1999
+ @author Tom Goodale
+ @desc
+ Register all the timer functions associated with the
+ gettimeofday function.
+ @enddesc
+ @calls CCTK_ClockRegister
@@*/
static void CCTKi_RegisterTimersGetTimeOfDay(void)
{
cClockFuncs functions;
+
functions.n_vals = 1;
functions.create = CCTKi_TimerGetTimeOfDayCreate;
functions.destroy = CCTKi_TimerGetTimeOfDayDestroy;
@@ -471,101 +398,70 @@ static void CCTKi_RegisterTimersGetTimeOfDay(void)
CCTK_ClockRegister("GetTimeOfDay", &functions);
}
-
+
#endif /* HAVE_TIME_GETTIMEOFDAY */
/*********************************************************************
- **************** getrusage based timers *******************
+ **************** getrusage based timer *******************
*********************************************************************/
#ifdef HAVE_TIME_GETRUSAGE
-#include <sys/resource.h>
-
-/* A structure to hold the relevent data */
-typedef struct
-{
- struct timeval total;
- struct timeval last;
-} t_GetrUsageTimer;
-
-static char *GetrUsageHeading = "getrusage";
-static char *GetrUsageUnits = "secs";
-
/*@@
- @routine CCTKi_TimerGetrUsageCreate
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Create the timer structure for use with the getrusage function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetrUsageCreate
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Create the timer structure for use with the getrusage function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@returntype void *
- @returndesc
- timer structure
+ @returndesc
+ timer structure, or NULL if allocation failed
@endreturndesc
-
@@*/
static void *CCTKi_TimerGetrUsageCreate(int timernum)
{
- t_GetrUsageTimer *this;
+ t_GetrUsageTimer *retval;
- timernum = timernum;
- this = malloc(sizeof(t_GetrUsageTimer));
- if(this)
- {
- this->total.tv_sec = 0;
- this->total.tv_usec = 0;
- }
+ (void) (timernum + 0);
- return this;
+ retval = calloc (1, sizeof (t_GetrUsageTimer));
+
+ return (retval);
}
+
/*@@
- @routine CCTKi_TimerGetrUsageDestroy
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Destroy the timer structure for use with the getrusage function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetrUsageDestroy
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Destroy the timer structure for use with the getrusage function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var data
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetrUsageDestroy(int timernum, void *data)
{
- timernum = timernum;
+ (void) (timernum + 0);
if(data)
{
free(data);
@@ -574,249 +470,190 @@ static void CCTKi_TimerGetrUsageDestroy(int timernum, void *data)
/*@@
- @routine CCTKi_TimerGetrUsageStart
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Start the timer with the getrusage function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetrUsageStart
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Start the timer with the getrusage function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetrUsageStart(int timernum, void *idata)
{
+ struct rusage ru;
t_GetrUsageTimer *data;
- struct rusage ru;
- timernum = timernum;
- data = (t_GetrUsageTimer *)idata;
+ (void) (timernum + 0);
getrusage(RUSAGE_SELF, &ru);
+ data = (t_GetrUsageTimer *) idata;
data->last = ru.ru_utime;
-
-#ifdef DEBUG_TIMERS
- printf("Starting getrusage timer %d\n", timernum);
-#endif
}
+
/*@@
- @routine CCTKi_TimerGetrUsageStop
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Stop the timer with the getrusage function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetrUsageStop
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Stop the timer with the getrusage function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetrUsageStop(int timernum, void *idata)
{
+ struct rusage ru;
t_GetrUsageTimer *data;
- struct rusage ru;
- timernum = timernum;
- data = (t_GetrUsageTimer *)idata;
+ (void) (timernum + 0);
getrusage(RUSAGE_SELF, &ru);
- data->total.tv_sec += ru.ru_utime.tv_sec - data->last.tv_sec;
+ data = (t_GetrUsageTimer *) idata;
+ data->total.tv_sec += ru.ru_utime.tv_sec - data->last.tv_sec;
data->total.tv_usec += ru.ru_utime.tv_usec - data->last.tv_usec;
-
-#ifdef DEBUG_TIMERS
- printf("Starting getrusage timer %d\n", timernum);
-#endif
}
+
/*@@
- @routine CCTKi_TimerGetrUsageReset
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Reset the timer with the getrusage function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetrUsageReset
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Reset the timer with the getrusage function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetrUsageReset(int timernum, void *idata)
{
t_GetrUsageTimer *data;
- timernum = timernum;
- data = (t_GetrUsageTimer *)idata;
- data->total.tv_sec = 0;
- data->total.tv_usec = 0;
+ (void) (timernum + 0);
+ data = (t_GetrUsageTimer *) idata;
+ data->total.tv_sec = data->total.tv_usec = 0;
}
+
/*@@
- @routine CCTKi_TimerGetrUsageGet
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Get the time recorded with the getrusage function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetrUsageGet
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Get the time recorded with the getrusage function.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
+ @endvar
@var vals
@vdesc Timer value structure
@vtype cTimerVal
@vio out
- @vcomment
-
- @endvar
-
-
+ @endvar
@@*/
static void CCTKi_TimerGetrUsageGet(int timernum, void *idata, cTimerVal *vals)
{
t_GetrUsageTimer *data;
- data = (t_GetrUsageTimer *)idata;
- timernum = timernum;
+ (void) (timernum + 0);
+ data = (t_GetrUsageTimer *) idata;
vals[0].type = val_double;
vals[0].heading = GetrUsageHeading;
vals[0].units = GetrUsageUnits;
vals[0].val.d = data->total.tv_sec + (double)data->total.tv_usec/1000000.0;
-
}
+
/*@@
- @routine CCTKi_TimerGetrUsageSet
- @date Wed Oct 20 18:28:19 1999
- @author Tom Goodale
- @desc
- Set the time for a getrusage function based timer.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @routine CCTKi_TimerGetrUsageSet
+ @date Wed Oct 20 18:28:19 1999
+ @author Tom Goodale
+ @desc
+ Set the time for a getrusage function based timer.
+ @enddesc
+
@var timernum
@vdesc timer number
@vtype int
- @vio in
- @vcomment
-
- @endvar
+ @vio unused
+ @endvar
@var idata
@vdesc timer data
@vtype void *
@vio inout
- @vcomment
-
- @endvar
+ @endvar
@var vals
@vdesc Timer value structure
- @vtype cTimerVal
+ @vtype cTimerVal *
@vio in
- @vcomment
-
- @endvar
-
+ @endvar
@@*/
static void CCTKi_TimerGetrUsageSet(int timernum, void *idata, cTimerVal *vals)
{
t_GetrUsageTimer *data;
- timernum = timernum;
- data = (t_GetrUsageTimer *)idata;
+ (void) (timernum + 0);
- data->total.tv_sec = (long)vals[0].val.d;
- data->total.tv_usec = (long)(1000000*vals[0].val.d-data->total.tv_sec);
+ data = (t_GetrUsageTimer *) idata;
+ data->total.tv_sec = vals[0].val.d;
+ data->total.tv_usec = 1000000*vals[0].val.d - data->total.tv_sec;
}
- /*@@
- @routine CCTKi_RegisterTimersGetrUsage
- @date Wed Oct 20 18:32:17 1999
- @author Tom Goodale
- @desc
- Register all the timer functions associated with the getrusage function.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+/*@@
+ @routine CCTKi_RegisterTimersGetrUsage
+ @date Wed Oct 20 18:32:17 1999
+ @author Tom Goodale
+ @desc
+ Register all the timer functions associated with the
+ getrusage function.
+ @enddesc
+ @calls CCTK_ClockRegister
@@*/
static void CCTKi_RegisterTimersGetrUsage(void)
{
@@ -832,7 +669,6 @@ static void CCTKi_RegisterTimersGetrUsage(void)
functions.set = CCTKi_TimerGetrUsageSet;
CCTK_ClockRegister("GetrUsage", &functions);
-
}
#endif /* HAVE_TIME_GETRUSAGE */