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 |
217 void OS::Sleep(int64_t millis) { | 225 void OS::Sleep(int64_t millis) { |
218 int64_t micros = millis * kMicrosecondsPerMillisecond; | 226 int64_t micros = millis * kMicrosecondsPerMillisecond; |
219 SleepMicros(micros); | 227 SleepMicros(micros); |
220 } | 228 } |
221 | 229 |
222 void OS::SleepMicros(int64_t micros) { | 230 void OS::SleepMicros(int64_t micros) { |
223 struct timespec req; // requested. | 231 struct timespec req; // requested. |
224 struct timespec rem; // remainder. | 232 struct timespec rem; // remainder. |
225 int64_t seconds = micros / kMicrosecondsPerSecond; | 233 int64_t seconds = micros / kMicrosecondsPerSecond; |
226 micros = micros - seconds * kMicrosecondsPerSecond; | 234 micros = micros - seconds * kMicrosecondsPerSecond; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 abort(); | 398 abort(); |
391 } | 399 } |
392 | 400 |
393 void OS::Exit(int code) { | 401 void OS::Exit(int code) { |
394 exit(code); | 402 exit(code); |
395 } | 403 } |
396 | 404 |
397 } // namespace dart | 405 } // namespace dart |
398 | 406 |
399 #endif // defined(HOST_OS_ANDROID) | 407 #endif // defined(HOST_OS_ANDROID) |
OLD | NEW |