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_ANDROID) | 6 #if defined(HOST_OS_ANDROID) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <android/log.h> // NOLINT | 10 #include <android/log.h> // NOLINT |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 ASSERT(Utils::IsPowerOfTwo(alignment)); | 207 ASSERT(Utils::IsPowerOfTwo(alignment)); |
208 ASSERT(alignment >= kMinimumAlignment); | 208 ASSERT(alignment >= kMinimumAlignment); |
209 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); | 209 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); |
210 return alignment; | 210 return alignment; |
211 } | 211 } |
212 | 212 |
213 int OS::NumberOfAvailableProcessors() { | 213 int OS::NumberOfAvailableProcessors() { |
214 return sysconf(_SC_NPROCESSORS_ONLN); | 214 return sysconf(_SC_NPROCESSORS_ONLN); |
215 } | 215 } |
216 | 216 |
217 uintptr_t OS::MaxRSS() { | |
218 struct rusage usage; | |
219 usage.ru_maxrss = 0; | |
220 int r = getrusage(RUSAGE_SELF, &usage); | |
221 ASSERT(r == 0); | |
222 return usage.ru_maxrss * KB; | |
223 } | |
224 | |
225 void OS::Sleep(int64_t millis) { | 217 void OS::Sleep(int64_t millis) { |
226 int64_t micros = millis * kMicrosecondsPerMillisecond; | 218 int64_t micros = millis * kMicrosecondsPerMillisecond; |
227 SleepMicros(micros); | 219 SleepMicros(micros); |
228 } | 220 } |
229 | 221 |
230 void OS::SleepMicros(int64_t micros) { | 222 void OS::SleepMicros(int64_t micros) { |
231 struct timespec req; // requested. | 223 struct timespec req; // requested. |
232 struct timespec rem; // remainder. | 224 struct timespec rem; // remainder. |
233 int64_t seconds = micros / kMicrosecondsPerSecond; | 225 int64_t seconds = micros / kMicrosecondsPerSecond; |
234 micros = micros - seconds * kMicrosecondsPerSecond; | 226 micros = micros - seconds * kMicrosecondsPerSecond; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 abort(); | 390 abort(); |
399 } | 391 } |
400 | 392 |
401 void OS::Exit(int code) { | 393 void OS::Exit(int code) { |
402 exit(code); | 394 exit(code); |
403 } | 395 } |
404 | 396 |
405 } // namespace dart | 397 } // namespace dart |
406 | 398 |
407 #endif // defined(HOST_OS_ANDROID) | 399 #endif // defined(HOST_OS_ANDROID) |
OLD | NEW |