00001 #ifndef __TIMER_H_DEF
00002 #define __TIMER_H_DEF
00003
00004 #include <sys/time.h>
00005
00006 #define TIME(code) { PushTimer(); code; printf("Time spent executing '"#code"' = %f\n",PopTimer()); }
00007
00008 void StartTimer(int n);
00009 float StopTimer(int n);
00010 void PushTimer(void);
00011 float PopTimer(void);
00012
00013 struct TIMER_struct
00014 {
00015 struct timeval first;
00016 struct timeval second;
00017 };
00018
00019 typedef struct TIMER_struct TIMER_t;
00020
00021 TIMER_t *CreateTimer();
00022 float GetElapsedTime(TIMER_t *timer);
00023 void ResetTimer(TIMER_t *timer);
00024 void DestroyTimer(TIMER_t **timer);
00025
00026 #endif