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 |
209 void OS::Sleep(int64_t millis) { | 215 void OS::Sleep(int64_t millis) { |
210 ::Sleep(millis); | 216 ::Sleep(millis); |
211 } | 217 } |
212 | 218 |
213 void OS::SleepMicros(int64_t micros) { | 219 void OS::SleepMicros(int64_t micros) { |
214 // Windows only supports millisecond sleeps. | 220 // Windows only supports millisecond sleeps. |
215 if (micros < kMicrosecondsPerMillisecond) { | 221 if (micros < kMicrosecondsPerMillisecond) { |
216 // Calling ::Sleep with 0 has no determined behaviour, round up. | 222 // Calling ::Sleep with 0 has no determined behaviour, round up. |
217 micros = kMicrosecondsPerMillisecond; | 223 micros = kMicrosecondsPerMillisecond; |
218 } | 224 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // TODO(zra): Remove once VM shuts down cleanly. | 409 // TODO(zra): Remove once VM shuts down cleanly. |
404 private_flag_windows_run_tls_destructors = false; | 410 private_flag_windows_run_tls_destructors = false; |
405 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 411 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
406 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 412 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
407 ::ExitProcess(code); | 413 ::ExitProcess(code); |
408 } | 414 } |
409 | 415 |
410 } // namespace dart | 416 } // namespace dart |
411 | 417 |
412 #endif // defined(HOST_OS_WINDOWS) | 418 #endif // defined(HOST_OS_WINDOWS) |
OLD | NEW |