File tree 2 files changed +21
-17
lines changed
sbe-benchmarks/src/main/cpp
2 files changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,23 @@ int main(int argc, char **argv)
19
19
{
20
20
BenchmarkRunner::run ();
21
21
return 0 ;
22
- }
22
+ }
23
+
24
+ #ifdef _WIN32
25
+ #include < Windows.h>
26
+ uint64_t BenchmarkRunner::currentTimestamp (void )
27
+ {
28
+ static LARGE_INTEGER freq;
29
+ static int first = 1 ;
30
+ LARGE_INTEGER counter;
31
+
32
+ ::QueryPerformanceCounter (&counter);
33
+ if (1 == first)
34
+ {
35
+ ::QueryPerformanceFrequency (&freq);
36
+ first = 0 ;
37
+ }
38
+ return (1000000000 * counter.QuadPart )/freq.QuadPart ;
39
+ }
40
+
41
+ #endif
Original file line number Diff line number Diff line change 28
28
#elif defined(__linux__)
29
29
# include < time.h>
30
30
#elif defined(WIN32) || defined(_WIN32)
31
- # include < windows.h>
32
31
#else
33
32
# error "Must define Darwin or __linux__ or WIN32"
34
33
#endif /* platform includes */
@@ -213,21 +212,7 @@ class BenchmarkRunner
213
212
return end_timestamp - start_timestamp;
214
213
};
215
214
#elif defined(WIN32) || defined(_WIN32)
216
- static uint64_t currentTimestamp (void )
217
- {
218
- static LARGE_INTEGER freq;
219
- static int first = 1 ;
220
- LARGE_INTEGER counter;
221
-
222
- ::QueryPerformanceCounter (&counter);
223
- if (1 == first)
224
- {
225
- ::QueryPerformanceFrequency (&freq);
226
- first = 0 ;
227
- }
228
- return (1000000000 * counter.QuadPart )/freq.QuadPart ;
229
- }
230
-
215
+ static uint64_t currentTimestamp (void );
231
216
static uint64_t elapsedNanoseconds (uint64_t start_timestamp, uint64_t end_timestamp)
232
217
{
233
218
return end_timestamp - start_timestamp;
You can’t perform that action at this time.
0 commit comments