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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 bool OS::AllowStackFrameIteratorFromAnotherThread() { | 234 bool OS::AllowStackFrameIteratorFromAnotherThread() { |
235 return false; | 235 return false; |
236 } | 236 } |
237 | 237 |
238 | 238 |
239 int OS::NumberOfAvailableProcessors() { | 239 int OS::NumberOfAvailableProcessors() { |
240 return sysconf(_SC_NPROCESSORS_ONLN); | 240 return sysconf(_SC_NPROCESSORS_ONLN); |
241 } | 241 } |
242 | 242 |
243 | 243 |
| 244 uintptr_t OS::MaxRSS() { |
| 245 struct rusage usage; |
| 246 usage.ru_maxrss = 0; |
| 247 int r = getrusage(RUSAGE_SELF, &usage); |
| 248 ASSERT(r == 0); |
| 249 return usage.ru_maxrss; |
| 250 } |
| 251 |
| 252 |
244 void OS::Sleep(int64_t millis) { | 253 void OS::Sleep(int64_t millis) { |
245 int64_t micros = millis * kMicrosecondsPerMillisecond; | 254 int64_t micros = millis * kMicrosecondsPerMillisecond; |
246 SleepMicros(micros); | 255 SleepMicros(micros); |
247 } | 256 } |
248 | 257 |
249 | 258 |
250 void OS::SleepMicros(int64_t micros) { | 259 void OS::SleepMicros(int64_t micros) { |
251 struct timespec req; // requested. | 260 struct timespec req; // requested. |
252 struct timespec rem; // remainder. | 261 struct timespec rem; // remainder. |
253 int64_t seconds = micros / kMicrosecondsPerSecond; | 262 int64_t seconds = micros / kMicrosecondsPerSecond; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 456 } |
448 | 457 |
449 | 458 |
450 void OS::Exit(int code) { | 459 void OS::Exit(int code) { |
451 exit(code); | 460 exit(code); |
452 } | 461 } |
453 | 462 |
454 } // namespace dart | 463 } // namespace dart |
455 | 464 |
456 #endif // defined(TARGET_OS_MACOS) | 465 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |