EGtimer


Detailed Description

Here we implement types and functions for timer functions

Version:
1.0.1
History:
Note:
Up to now, this code will only work on linux machines, and maybe on unix/posix systems.


Files

file  eg_timer.h

Data Structures

struct  EGtimer_t
 this structure holds a timer structure More...

Defines

#define __EGzeit()
 Get system time.
#define EGtimerReset(timer)   ({(timer)->time = 0;})
 this function reset the accumulated time to zero
#define EGtimerStart(timer)   ({(timer)->stime = __EGzeit();})
 Set a new starting time for the timer.
#define EGtimerStop(timer)   ({(timer)->time += __EGzeit() - (timer)->stime;})
 Stop a 'running' timer and accumulate the run time.
#define EGwallClockTimer_t   EGtimer_t
 This is done for backward compability, we used to define EGwallClockTimer_t just as the normal timer, so in reality we don't need another type, but keep the name so that older code depending on this still compiles.
#define EGwallClockTimerReset(timer)   EGtimerReset(timer)
 Reset the accumulated time to zero.
#define EGwallClockTimerStart(timer)   ({(timer)->stime = time(0);})
 Set the starting time the current (wall) time.
#define EGwallClockTimerStop(timer)
 Stop a 'running' timer and accumulate the (wall) runing time.


Define Documentation

 
#define __EGzeit  ) 
 

Value:

({\
  struct rusage __EGzeit_ru;\
  int __EGzeit_st = getrusage(RUSAGE_SELF,&__EGzeit_ru);\
  EXIT(__EGzeit_st,"getrusage failed with code error %d (%s)", errno, \
  strerror(errno));\
  (((double)__EGzeit_ru.ru_utime.tv_sec) + \
  ((double)__EGzeit_ru.ru_utime.tv_usec)/1000000);})
Get system time.

This function is for internal purposes only and should not be called from the user space, it ask the (user) time from the system.

Returns:
the time (in seconds) stored as a double.

Definition at line 61 of file eg_timer.h.

#define EGtimerReset timer   )     ({(timer)->time = 0;})
 

this function reset the accumulated time to zero

Definition at line 128 of file eg_timer.h.

#define EGtimerStart timer   )     ({(timer)->stime = __EGzeit();})
 

Set a new starting time for the timer.

Parameters:
timer pointer to a EGtimer_t structure.
Returns:
starting time (in seconds), and the type is a double.

Definition at line 119 of file eg_timer.h.

#define EGtimerStop timer   )     ({(timer)->time += __EGzeit() - (timer)->stime;})
 

Stop a 'running' timer and accumulate the run time.

Returns:
the time elapsed since the last 'start' call (in seconds).

Definition at line 124 of file eg_timer.h.

#define EGwallClockTimer_t   EGtimer_t
 

This is done for backward compability, we used to define EGwallClockTimer_t just as the normal timer, so in reality we don't need another type, but keep the name so that older code depending on this still compiles.

Definition at line 113 of file eg_timer.h.

#define EGwallClockTimerReset timer   )     EGtimerReset(timer)
 

Reset the accumulated time to zero.

Definition at line 143 of file eg_timer.h.

#define EGwallClockTimerStart timer   )     ({(timer)->stime = time(0);})
 

Set the starting time the current (wall) time.

Returns:
the current wall time.

Definition at line 133 of file eg_timer.h.

#define EGwallClockTimerStop timer   ) 
 

Value:

({\
  (timer)->time += difftime(time(0),(timer)->stime);})
Stop a 'running' timer and accumulate the (wall) runing time.

Returns:
the wall time elapsed since the last initialization.

Definition at line 138 of file eg_timer.h.


Generated on Wed Nov 21 09:38:35 2007 for MTgomory by  doxygen 1.4.6