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_MACOS) | 6 #if defined(HOST_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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 ASSERT(Utils::IsPowerOfTwo(alignment)); | 193 ASSERT(Utils::IsPowerOfTwo(alignment)); |
194 ASSERT(alignment >= kMinimumAlignment); | 194 ASSERT(alignment >= kMinimumAlignment); |
195 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); | 195 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); |
196 return alignment; | 196 return alignment; |
197 } | 197 } |
198 | 198 |
199 int OS::NumberOfAvailableProcessors() { | 199 int OS::NumberOfAvailableProcessors() { |
200 return sysconf(_SC_NPROCESSORS_ONLN); | 200 return sysconf(_SC_NPROCESSORS_ONLN); |
201 } | 201 } |
202 | 202 |
| 203 uintptr_t OS::MaxRSS() { |
| 204 struct rusage usage; |
| 205 usage.ru_maxrss = 0; |
| 206 int r = getrusage(RUSAGE_SELF, &usage); |
| 207 ASSERT(r == 0); |
| 208 return usage.ru_maxrss; |
| 209 } |
| 210 |
203 void OS::Sleep(int64_t millis) { | 211 void OS::Sleep(int64_t millis) { |
204 int64_t micros = millis * kMicrosecondsPerMillisecond; | 212 int64_t micros = millis * kMicrosecondsPerMillisecond; |
205 SleepMicros(micros); | 213 SleepMicros(micros); |
206 } | 214 } |
207 | 215 |
208 void OS::SleepMicros(int64_t micros) { | 216 void OS::SleepMicros(int64_t micros) { |
209 struct timespec req; // requested. | 217 struct timespec req; // requested. |
210 struct timespec rem; // remainder. | 218 struct timespec rem; // remainder. |
211 int64_t seconds = micros / kMicrosecondsPerSecond; | 219 int64_t seconds = micros / kMicrosecondsPerSecond; |
212 if (seconds > kMaxInt32) { | 220 if (seconds > kMaxInt32) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 abort(); | 414 abort(); |
407 } | 415 } |
408 | 416 |
409 void OS::Exit(int code) { | 417 void OS::Exit(int code) { |
410 exit(code); | 418 exit(code); |
411 } | 419 } |
412 | 420 |
413 } // namespace dart | 421 } // namespace dart |
414 | 422 |
415 #endif // defined(HOST_OS_MACOS) | 423 #endif // defined(HOST_OS_MACOS) |
OLD | NEW |