12 #include <sys/timeb.h>
26 #define CLOCK_ID CLOCK_REALTIME
33 #if defined(POSIX_TIME)
37 #define TIME_CALL(x) clock_gettime(CLOCK_ID, x)
41 x.tv_sec = (long)(ti);
42 x.tv_nsec = (long)((ti - x.tv_sec) * 1.0e9);
47 return (
double)x.tv_sec + 1.0e-9 * x.tv_nsec;
55 #define TIME_CALL(x) \
63 x.millitm = (
unsigned short)((ti - x.time) * 1.0e6f);
68 return x.time + 1e-6 * x.millitm;
73 #define TIME_CALL(x) gettimeofday(x, NULL)
77 x.tv_sec = (long)(ti);
78 x.tv_usec = (long)((ti - x.tv_sec) * 1.0e6);
83 return x.tv_sec + 1e-6 * x.tv_usec;
89 #ifndef CREATE_TIMEBASE_PROG
95 coTimer::mark(text); \
97 #define MARK1(mask, d1) \
99 sprintf(coTimer::mark(), mask, (d1)); \
101 #define MARK2(mask, d1, d2) \
103 sprintf(coTimer::mark(), mask, (d1), (d2)); \
105 #define MARK3(mask, d1, d2, d3) \
107 sprintf(coTimer::mark(), mask, (d1), (d2), (d3)); \
110 #define MARK4(mask, d1, d2, d3, d4) \
112 sprintf(coTimer::mark(), mask, (d1), (d2), (d3), (d4)); \
115 #define MARK5(mask, d1, d2, d3, d4, d5) \
117 sprintf(coTimer::mark(), mask, (d1), (d2), (d3), (d4), (d5)); \
120 #define MARK6(mask, d1, d2, d3, d4, d5, d6) \
122 sprintf(coTimer::mark(), mask, (d1), (d2), (d3), (d4), (d5), (d6)); \
140 static char s_buffer[MAX_LEN];
142 virtual void sigHandler(
int sigNo);
149 coTimer(
const char *fileNameBase,
int length,
bool handleSignals);
154 if (actElem >= maxElem)
159 return descField + MAX_LEN * actElem;
168 if (actElem >= maxElem)
173 strcpy(descField + MAX_LEN * actElem,
string);
176 void mark(
const char *)
186 static void init(
const char *fileNameBase,
int length,
bool handleSignals =
true);
193 res = s_timerObj->int_mark();
199 static void mark(
const char *
string)
202 s_timerObj->int_mark(
string);
205 #endif // getTimeBase
static void mark(const char *string)
Definition: coTimer.h:199
GLenum GLuint GLenum GLsizei length
Definition: khronos-glext.h:6279
void int_mark(const char *string)
Definition: coTimer.h:166
Definition: coSignal.h:102
static coTimer * s_timerObj
we create the getTimeBase program in here, too
Definition: coTimer.h:139
#define UTILEXPORT
Definition: coExport.h:194
double coTimerGetFloat(const TimeType &x)
Definition: coTimer.h:81
struct timeval TimeType
Definition: coTimer.h:72
Definition: coTimer.h:126
virtual const char * sigHandlerName()
Definition: coTimer.h:143
char * int_mark()
Definition: coTimer.h:151
std::ofstream * stream
Definition: coTimer.h:137
int maxElem
Definition: coTimer.h:134
TimeType * timeField
Definition: coTimer.h:136
char * descField
Definition: coTimer.h:135
#define TIME_CALL(x)
Definition: coTimer.h:73
GLuint res
Definition: khronos-glext.h:10588
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
static char * mark()
Definition: coTimer.h:189
void TIME_SET(TimeType &x, double ti)
Definition: coTimer.h:75