summaryrefslogtreecommitdiff
path: root/src/VBox/GuestHost/OpenGL/include/cr_timer.h
blob: 316ba3484bd3cc2642c6ccd2939641d0bfcc7d81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef CR_TIMER_H
#define CR_TIMER_H

#ifndef WINDOWS
#include <sys/time.h>

#if defined (IRIX) || defined( IRIX64 )
typedef unsigned long long iotimer64_t;
typedef unsigned int iotimer32_t;
#endif
#else
#include <windows.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef struct Timer 
{
	double time0, elapsed;
	char running;

	int fd;
#if defined (IRIX) || defined( IRIX64 )
	unsigned long long counter64;
	unsigned int counter32;
	unsigned int cycleval;

	volatile iotimer64_t *iotimer_addr64;
	volatile iotimer32_t *iotimer_addr32;

	void *unmapLocation;
	int unmapSize;
#elif defined(WINDOWS)
	LARGE_INTEGER performance_counter, performance_frequency;
	double one_over_frequency;
#elif defined( Linux ) || defined( FreeBSD ) || defined(DARWIN) || defined(AIX) || defined (SunOS) || defined(OSF1)
	struct timeval timeofday;
#endif
} CRTimer;

CRTimer *crTimerNewTimer( void );
void crDestroyTimer( CRTimer *t );
void crStartTimer( CRTimer *t );
void crStopTimer( CRTimer *t );
void crResetTimer( CRTimer *t );
double crTimerTime( CRTimer *t );

#ifdef __cplusplus
}
#endif

#endif /* CR_TIMER_H */