aboutsummaryrefslogtreecommitdiffstats
path: root/src/timer/win32_query_perf_ctr
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-11 20:58:37 +0000
committerlloyd <[email protected]>2008-11-11 20:58:37 +0000
commit8879a51da7c3b93e27439122cea5d5aa81ae38c3 (patch)
treeb1faa753266d4a762fc38252df35a2435b757b92 /src/timer/win32_query_perf_ctr
parent6eff33ae263109ccbbeb32bd0ffb25c77140cc45 (diff)
Move utils/{timer,mutex} to toplevel
Diffstat (limited to 'src/timer/win32_query_perf_ctr')
-rw-r--r--src/timer/win32_query_perf_ctr/info.txt26
-rw-r--r--src/timer/win32_query_perf_ctr/tm_win32.cpp21
-rw-r--r--src/timer/win32_query_perf_ctr/tm_win32.h25
3 files changed, 72 insertions, 0 deletions
diff --git a/src/timer/win32_query_perf_ctr/info.txt b/src/timer/win32_query_perf_ctr/info.txt
new file mode 100644
index 000000000..e74259184
--- /dev/null
+++ b/src/timer/win32_query_perf_ctr/info.txt
@@ -0,0 +1,26 @@
+realname "Win32 Timer"
+
+define TIMER_WIN32
+modset win32
+
+load_on auto
+
+<add>
+tm_win32.cpp
+tm_win32.h
+</add>
+
+<os>
+cygwin
+windows
+mingw
+</os>
+
+<libs>
+windows -> user32
+</libs>
+
+<requires>
+timer
+</requires>
+
diff --git a/src/timer/win32_query_perf_ctr/tm_win32.cpp b/src/timer/win32_query_perf_ctr/tm_win32.cpp
new file mode 100644
index 000000000..58f7b0f55
--- /dev/null
+++ b/src/timer/win32_query_perf_ctr/tm_win32.cpp
@@ -0,0 +1,21 @@
+/*************************************************
+* Win32 Timer Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/tm_win32.h>
+#include <windows.h>
+
+namespace Botan {
+
+/*************************************************
+* Get the timestamp *
+*************************************************/
+u64bit Win32_Timer::clock() const
+ {
+ LARGE_INTEGER tv;
+ ::QueryPerformanceCounter(&tv);
+ return tv.QuadPart;
+ }
+
+}
diff --git a/src/timer/win32_query_perf_ctr/tm_win32.h b/src/timer/win32_query_perf_ctr/tm_win32.h
new file mode 100644
index 000000000..d458d0a3f
--- /dev/null
+++ b/src/timer/win32_query_perf_ctr/tm_win32.h
@@ -0,0 +1,25 @@
+/*************************************************
+* Win32 Timer Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_TIMER_WIN32_H__
+#define BOTAN_TIMER_WIN32_H__
+
+#include <botan/timer.h>
+
+namespace Botan {
+
+/*************************************************
+* Win32 Timer *
+*************************************************/
+class BOTAN_DLL Win32_Timer : public Timer
+ {
+ public:
+ std::string name() const { return "Win32 QueryPerformanceCounter"; }
+ u64bit clock() const;
+ };
+
+}
+
+#endif