OLD | NEW |
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 Loading... |
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 Loading... |
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) |
OLD | NEW |