1 | #ifndef CR_TIMER_H
|
---|
2 | #define CR_TIMER_H
|
---|
3 |
|
---|
4 | #ifndef WINDOWS
|
---|
5 | #include <sys/time.h>
|
---|
6 |
|
---|
7 | #if defined (IRIX) || defined( IRIX64 )
|
---|
8 | typedef unsigned long long iotimer64_t;
|
---|
9 | typedef unsigned int iotimer32_t;
|
---|
10 | #endif
|
---|
11 | #else
|
---|
12 | # ifdef VBOX
|
---|
13 | # include <iprt/win/windows.h>
|
---|
14 | # else
|
---|
15 | #include <windows.h>
|
---|
16 | # endif
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | #ifdef __cplusplus
|
---|
20 | extern "C" {
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | typedef struct Timer
|
---|
24 | {
|
---|
25 | double time0, elapsed;
|
---|
26 | char running;
|
---|
27 |
|
---|
28 | int fd;
|
---|
29 | #if defined (IRIX) || defined( IRIX64 )
|
---|
30 | unsigned long long counter64;
|
---|
31 | unsigned int counter32;
|
---|
32 | unsigned int cycleval;
|
---|
33 |
|
---|
34 | volatile iotimer64_t *iotimer_addr64;
|
---|
35 | volatile iotimer32_t *iotimer_addr32;
|
---|
36 |
|
---|
37 | void *unmapLocation;
|
---|
38 | int unmapSize;
|
---|
39 | #elif defined(WINDOWS)
|
---|
40 | LARGE_INTEGER performance_counter, performance_frequency;
|
---|
41 | double one_over_frequency;
|
---|
42 | #elif defined( Linux ) || defined( FreeBSD ) || defined(DARWIN) || defined(AIX) || defined (SunOS) || defined(OSF1)
|
---|
43 | struct timeval timeofday;
|
---|
44 | #endif
|
---|
45 | } CRTimer;
|
---|
46 |
|
---|
47 | CRTimer *crTimerNewTimer( void );
|
---|
48 | void crDestroyTimer( CRTimer *t );
|
---|
49 | void crStartTimer( CRTimer *t );
|
---|
50 | void crStopTimer( CRTimer *t );
|
---|
51 | void crResetTimer( CRTimer *t );
|
---|
52 | double crTimerTime( CRTimer *t );
|
---|
53 |
|
---|
54 | #ifdef __cplusplus
|
---|
55 | }
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | #endif /* CR_TIMER_H */
|
---|