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
3 // found in the LICENSE file.
5 #ifndef TRACELINE_RDTSC_H_
6 #define TRACELINE_RDTSC_H_
15 class RDTSCNormalizer
{
18 ~RDTSCNormalizer() { }
21 LARGE_INTEGER freq
, now
;
22 if (QueryPerformanceFrequency(&freq
) == 0) {
25 freq_
= freq
.QuadPart
;
27 if (QueryPerformanceCounter(&now
) == 0) {
30 start_
= now
.QuadPart
;
33 // Calculate the time from start for a given processor.
34 double MsFromStart(void* procid
, __int64 stamp
) {
35 return (stamp
- start_
) / (freq_
/ 1000.0);
43 #endif // TRACELINE_RDTSC_H_