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 | |
211 void OS::Sleep(int64_t millis) { | 203 void OS::Sleep(int64_t millis) { |
212 int64_t micros = millis * kMicrosecondsPerMillisecond; | 204 int64_t micros = millis * kMicrosecondsPerMillisecond; |
213 SleepMicros(micros); | 205 SleepMicros(micros); |
214 } | 206 } |
215 | 207 |
216 void OS::SleepMicros(int64_t micros) { | 208 void OS::SleepMicros(int64_t micros) { |
217 struct timespec req; // requested. | 209 struct timespec req; // requested. |
218 struct timespec rem; // remainder. | 210 struct timespec rem; // remainder. |
219 int64_t seconds = micros / kMicrosecondsPerSecond; | 211 int64_t seconds = micros / kMicrosecondsPerSecond; |
220 if (seconds > kMaxInt32) { | 212 if (seconds > kMaxInt32) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 abort(); | 406 abort(); |
415 } | 407 } |
416 | 408 |
417 void OS::Exit(int code) { | 409 void OS::Exit(int code) { |
418 exit(code); | 410 exit(code); |
419 } | 411 } |
420 | 412 |
421 } // namespace dart | 413 } // namespace dart |
422 | 414 |
423 #endif // defined(HOST_OS_MACOS) | 415 #endif // defined(HOST_OS_MACOS) |
OLD | NEW |