| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // High resolution timer functions for use in Windows. | 5 // High resolution timer functions for use in Windows. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_SYNC_UTIL_HIGHRES_TIMER_WIN32_H_ | 7 #ifndef CHROME_BROWSER_SYNC_UTIL_HIGHRES_TIMER_WIN_H_ |
| 8 #define CHROME_BROWSER_SYNC_UTIL_HIGHRES_TIMER_WIN32_H_ | 8 #define CHROME_BROWSER_SYNC_UTIL_HIGHRES_TIMER_WIN_H_ |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 | 11 |
| 12 // A handy class for reliably measuring wall-clock time with decent resolution, | 12 // A handy class for reliably measuring wall-clock time with decent resolution, |
| 13 // even on multi-processor machines and on laptops (where RDTSC potentially | 13 // even on multi-processor machines and on laptops (where RDTSC potentially |
| 14 // returns different results on different processors and/or the RDTSC timer | 14 // returns different results on different processors and/or the RDTSC timer |
| 15 // clocks at different rates depending on the power state of the CPU, | 15 // clocks at different rates depending on the power state of the CPU, |
| 16 // respectively). | 16 // respectively). |
| 17 class HighresTimer { | 17 class HighresTimer { |
| 18 public: | 18 public: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 inline ULONGLONG HighresTimer::GetCurrentTicks() { | 68 inline ULONGLONG HighresTimer::GetCurrentTicks() { |
| 69 LARGE_INTEGER ticks; | 69 LARGE_INTEGER ticks; |
| 70 ::QueryPerformanceCounter(&ticks); | 70 ::QueryPerformanceCounter(&ticks); |
| 71 return ticks.QuadPart; | 71 return ticks.QuadPart; |
| 72 } | 72 } |
| 73 | 73 |
| 74 inline ULONGLONG HighresTimer::GetElapsedTicks() const { | 74 inline ULONGLONG HighresTimer::GetElapsedTicks() const { |
| 75 return start_ticks_ - GetCurrentTicks(); | 75 return start_ticks_ - GetCurrentTicks(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_SYNC_UTIL_HIGHRES_TIMER_WIN32_H_ | 78 #endif // CHROME_BROWSER_SYNC_UTIL_HIGHRES_TIMER_WIN_H_ |
| OLD | NEW |