| 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 |
| 11 #include <process.h> // NOLINT | 11 #include <process.h> // NOLINT |
| 12 #include <psapi.h> // NOLINT |
| 12 #include <time.h> // NOLINT | 13 #include <time.h> // NOLINT |
| 13 | 14 |
| 14 #include "platform/utils.h" | 15 #include "platform/utils.h" |
| 15 #include "platform/assert.h" | 16 #include "platform/assert.h" |
| 16 #include "vm/os_thread.h" | 17 #include "vm/os_thread.h" |
| 17 #include "vm/zone.h" | 18 #include "vm/zone.h" |
| 18 | 19 |
| 19 namespace dart { | 20 namespace dart { |
| 20 | 21 |
| 21 // Defined in vm/os_thread_win.cc | 22 // Defined in vm/os_thread_win.cc |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 229 } |
| 229 | 230 |
| 230 | 231 |
| 231 int OS::NumberOfAvailableProcessors() { | 232 int OS::NumberOfAvailableProcessors() { |
| 232 SYSTEM_INFO info; | 233 SYSTEM_INFO info; |
| 233 GetSystemInfo(&info); | 234 GetSystemInfo(&info); |
| 234 return info.dwNumberOfProcessors; | 235 return info.dwNumberOfProcessors; |
| 235 } | 236 } |
| 236 | 237 |
| 237 | 238 |
| 239 uinptr_t OS::MaxRSS() { |
| 240 PROCESS_MEMORY_COUNTERS pmc; |
| 241 GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); |
| 242 return pmc.PeakWorkingSetSize; |
| 243 } |
| 244 |
| 245 |
| 238 void OS::Sleep(int64_t millis) { | 246 void OS::Sleep(int64_t millis) { |
| 239 ::Sleep(millis); | 247 ::Sleep(millis); |
| 240 } | 248 } |
| 241 | 249 |
| 242 | 250 |
| 243 void OS::SleepMicros(int64_t micros) { | 251 void OS::SleepMicros(int64_t micros) { |
| 244 // Windows only supports millisecond sleeps. | 252 // Windows only supports millisecond sleeps. |
| 245 if (micros < kMicrosecondsPerMillisecond) { | 253 if (micros < kMicrosecondsPerMillisecond) { |
| 246 // Calling ::Sleep with 0 has no determined behaviour, round up. | 254 // Calling ::Sleep with 0 has no determined behaviour, round up. |
| 247 micros = kMicrosecondsPerMillisecond; | 255 micros = kMicrosecondsPerMillisecond; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 // TODO(zra): Remove once VM shuts down cleanly. | 455 // TODO(zra): Remove once VM shuts down cleanly. |
| 448 private_flag_windows_run_tls_destructors = false; | 456 private_flag_windows_run_tls_destructors = false; |
| 449 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 457 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
| 450 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 458 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
| 451 ::ExitProcess(code); | 459 ::ExitProcess(code); |
| 452 } | 460 } |
| 453 | 461 |
| 454 } // namespace dart | 462 } // namespace dart |
| 455 | 463 |
| 456 #endif // defined(TARGET_OS_WINDOWS) | 464 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |