summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/include/cr_timer.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
commitf8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch)
tree26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/GuestHost/OpenGL/include/cr_timer.h
parentInitial commit. (diff)
downloadvirtualbox-upstream.tar.xz
virtualbox-upstream.zip
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/include/cr_timer.h')
-rw-r--r--src/VBox/GuestHost/OpenGL/include/cr_timer.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/include/cr_timer.h b/src/VBox/GuestHost/OpenGL/include/cr_timer.h
new file mode 100644
index 00000000..9385a76c
--- /dev/null
+++ b/src/VBox/GuestHost/OpenGL/include/cr_timer.h
@@ -0,0 +1,58 @@
+#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
+# ifdef VBOX
+# include <iprt/win/windows.h>
+# else
+#include <windows.h>
+# endif
+#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 */