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_ANDROID) | 6 #if defined(TARGET_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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 bool OS::AllowStackFrameIteratorFromAnotherThread() { | 244 bool OS::AllowStackFrameIteratorFromAnotherThread() { |
245 return false; | 245 return false; |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 int OS::NumberOfAvailableProcessors() { | 249 int OS::NumberOfAvailableProcessors() { |
250 return sysconf(_SC_NPROCESSORS_ONLN); | 250 return sysconf(_SC_NPROCESSORS_ONLN); |
251 } | 251 } |
252 | 252 |
253 | 253 |
| 254 uintptr_t OS::MaxRSS() { |
| 255 struct rusage usage; |
| 256 usage.ru_maxrss = 0; |
| 257 int r = getrusage(RUSAGE_SELF, &usage); |
| 258 ASSERT(r == 0); |
| 259 return usage.ru_maxrss * KB; |
| 260 } |
| 261 |
| 262 |
254 void OS::Sleep(int64_t millis) { | 263 void OS::Sleep(int64_t millis) { |
255 int64_t micros = millis * kMicrosecondsPerMillisecond; | 264 int64_t micros = millis * kMicrosecondsPerMillisecond; |
256 SleepMicros(micros); | 265 SleepMicros(micros); |
257 } | 266 } |
258 | 267 |
259 | 268 |
260 void OS::SleepMicros(int64_t micros) { | 269 void OS::SleepMicros(int64_t micros) { |
261 struct timespec req; // requested. | 270 struct timespec req; // requested. |
262 struct timespec rem; // remainder. | 271 struct timespec rem; // remainder. |
263 int64_t seconds = micros / kMicrosecondsPerSecond; | 272 int64_t seconds = micros / kMicrosecondsPerSecond; |
(...skipping 183 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_ANDROID) | 465 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |