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(HOST_OS_WINDOWS) | 6 #if defined(HOST_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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 #error Unsupported architecture. | 199 #error Unsupported architecture. |
200 #endif | 200 #endif |
201 } | 201 } |
202 | 202 |
203 int OS::NumberOfAvailableProcessors() { | 203 int OS::NumberOfAvailableProcessors() { |
204 SYSTEM_INFO info; | 204 SYSTEM_INFO info; |
205 GetSystemInfo(&info); | 205 GetSystemInfo(&info); |
206 return info.dwNumberOfProcessors; | 206 return info.dwNumberOfProcessors; |
207 } | 207 } |
208 | 208 |
209 uintptr_t OS::MaxRSS() { | |
210 PROCESS_MEMORY_COUNTERS pmc; | |
211 GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); | |
212 return pmc.PeakWorkingSetSize; | |
213 } | |
214 | |
215 void OS::Sleep(int64_t millis) { | 209 void OS::Sleep(int64_t millis) { |
216 ::Sleep(millis); | 210 ::Sleep(millis); |
217 } | 211 } |
218 | 212 |
219 void OS::SleepMicros(int64_t micros) { | 213 void OS::SleepMicros(int64_t micros) { |
220 // Windows only supports millisecond sleeps. | 214 // Windows only supports millisecond sleeps. |
221 if (micros < kMicrosecondsPerMillisecond) { | 215 if (micros < kMicrosecondsPerMillisecond) { |
222 // Calling ::Sleep with 0 has no determined behaviour, round up. | 216 // Calling ::Sleep with 0 has no determined behaviour, round up. |
223 micros = kMicrosecondsPerMillisecond; | 217 micros = kMicrosecondsPerMillisecond; |
224 } | 218 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // TODO(zra): Remove once VM shuts down cleanly. | 403 // TODO(zra): Remove once VM shuts down cleanly. |
410 private_flag_windows_run_tls_destructors = false; | 404 private_flag_windows_run_tls_destructors = false; |
411 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 405 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
412 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 406 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
413 ::ExitProcess(code); | 407 ::ExitProcess(code); |
414 } | 408 } |
415 | 409 |
416 } // namespace dart | 410 } // namespace dart |
417 | 411 |
418 #endif // defined(HOST_OS_WINDOWS) | 412 #endif // defined(HOST_OS_WINDOWS) |
OLD | NEW |