1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the Chromium LICENSE file.
18 static double seconds()
20 static double clock_frequency
;
21 static bool have_frequency
;
24 QueryPerformanceCounter(&qpc
);
26 return qpc
.QuadPart
* clock_frequency
;
28 have_frequency
= true;
29 QueryPerformanceFrequency(&qpc
);
30 clock_frequency
= 1.0 / (double) qpc
.QuadPart
;
36 static double seconds()
39 gettimeofday(&now
, 0);
40 return now
.tv_sec
+ now
.tv_usec
* (1.0 / 1000000.0);
45 #define TIME(function, time) do { \
46 double start = seconds(); \
48 *time += seconds() - start; \
51 #endif // TESTS_TIMING_H