#include <sys/time.h>
#include <sys/types.h>
Go to the source code of this file.
Defines | |
#define | PROF_ADD_DURATION(DURATION, START, END) |
#define | PROF_CONVERT_TO_MICROS(DURATION, DOUBLE) DOUBLE = 1.0e6 * DURATION.tv_sec + DURATION.tv_usec; |
#define | PROF_DURATION_UNIT struct timeval |
#define | PROF_GET_TIME(TIME) gettimeofday(&TIME, NULL); |
#define | PROF_RESET_DURATION(DURATION) DURATION.tv_sec = DURATION.tv_usec = 0; |
#define | PROF_TIME_UNIT struct timeval |
#define PROF_ADD_DURATION | ( | DURATION, | |||
START, | |||||
END | ) |
if (END.tv_usec < START.tv_usec) { \ int nsec = (START.tv_usec - END.tv_usec) / 1000000 + 1; \ START.tv_usec -= 1000000 * nsec; \ START.tv_sec += nsec; \ } \ if (END.tv_usec - START.tv_usec > 1000000) { \ int nsec = (END.tv_usec - START.tv_usec) / 1000000; \ START.tv_usec += 1000000 * nsec; \ START.tv_sec -= nsec; \ } \ DURATION.tv_sec += END.tv_sec - START.tv_sec; \ DURATION.tv_usec += END.tv_usec - START.tv_usec;
Definition at line 80 of file timer_calls.h.
#define PROF_CONVERT_TO_MICROS | ( | DURATION, | |||
DOUBLE | ) | DOUBLE = 1.0e6 * DURATION.tv_sec + DURATION.tv_usec; |
Definition at line 93 of file timer_calls.h.
#define PROF_DURATION_UNIT struct timeval |
Definition at line 77 of file timer_calls.h.
#define PROF_GET_TIME | ( | TIME | ) | gettimeofday(&TIME, NULL); |
Definition at line 79 of file timer_calls.h.
#define PROF_RESET_DURATION | ( | DURATION | ) | DURATION.tv_sec = DURATION.tv_usec = 0; |
Definition at line 78 of file timer_calls.h.
#define PROF_TIME_UNIT struct timeval |
This file implements the macros for reading and converting system time. A total of six macros must be implemented:
PROF_TIME_UNIT - the data type for storing a time value PROF_DURATION_UNIT - the data type for storing an interval or a duration PROF_RESET_DURATION(DURATION) - resets a duration to zero PROF_GET_TIME(TIME) - gets the current system time PROF_ADD_DURATION(DURATION, START_TIME, END_TIME) - adds the interval between two time values to a duration PROF_CONVERT_TO_MICROS(DURATION,DOUBLE) - converts a duration to microseconds
Conversion is separate from read time, since we don't want to do it every time we read time, but only when we need to return it.
Definition at line 76 of file timer_calls.h.