Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: runtime/vm/os_win.cc

Issue 1504523002: Use a monotonic clock in the implementation of Stopwatch. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/os_macos.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 #include <malloc.h> // NOLINT 10 #include <malloc.h> // NOLINT
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 int64_t t_; 116 int64_t t_;
117 }; 117 };
118 TimeStamp time; 118 TimeStamp time;
119 GetSystemTimeAsFileTime(&time.ft_); 119 GetSystemTimeAsFileTime(&time.ft_);
120 return (time.t_ - kTimeEpoc) / kTimeScaler; 120 return (time.t_ - kTimeEpoc) / kTimeScaler;
121 } 121 }
122 122
123 123
124 static int64_t qpc_ticks_per_second = 0; 124 static int64_t qpc_ticks_per_second = 0;
125 125
126 int64_t OS::GetCurrentTraceMicros() { 126 int64_t OS::GetCurrentMonotonicMicros() {
127 if (qpc_ticks_per_second == 0) { 127 if (qpc_ticks_per_second == 0) {
128 // QueryPerformanceCounter not supported, fallback. 128 // QueryPerformanceCounter not supported, fallback.
129 return GetCurrentTimeMicros(); 129 return GetCurrentTimeMicros();
130 } 130 }
131 // Grab performance counter value. 131 // Grab performance counter value.
132 LARGE_INTEGER now; 132 LARGE_INTEGER now;
133 QueryPerformanceCounter(&now); 133 QueryPerformanceCounter(&now);
134 int64_t qpc_value = static_cast<int64_t>(now.QuadPart); 134 int64_t qpc_value = static_cast<int64_t>(now.QuadPart);
135 // Convert to microseconds. 135 // Convert to microseconds.
136 int64_t seconds = qpc_value / qpc_ticks_per_second; 136 int64_t seconds = qpc_value / qpc_ticks_per_second;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 393
394 void OS::Exit(int code) { 394 void OS::Exit(int code) {
395 exit(code); 395 exit(code);
396 } 396 }
397 397
398 } // namespace dart 398 } // namespace dart
399 399
400 #endif // defined(TARGET_OS_WINDOWS) 400 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/vm/os_macos.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698