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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 bool OS::AllowStackFrameIteratorFromAnotherThread() { | 253 bool OS::AllowStackFrameIteratorFromAnotherThread() { |
254 return false; | 254 return false; |
255 } | 255 } |
256 | 256 |
257 | 257 |
258 int OS::NumberOfAvailableProcessors() { | 258 int OS::NumberOfAvailableProcessors() { |
259 return sysconf(_SC_NPROCESSORS_ONLN); | 259 return sysconf(_SC_NPROCESSORS_ONLN); |
260 } | 260 } |
261 | 261 |
262 | 262 |
| 263 uintptr_t OS::MaxRSS() { |
| 264 struct rusage usage; |
| 265 usage.ru_maxrss = 0; |
| 266 int r = getrusage(RUSAGE_SELF, &usage); |
| 267 ASSERT(r == 0); |
| 268 return usage.ru_maxrss * KB; |
| 269 } |
| 270 |
| 271 |
263 void OS::Sleep(int64_t millis) { | 272 void OS::Sleep(int64_t millis) { |
264 int64_t micros = millis * kMicrosecondsPerMillisecond; | 273 int64_t micros = millis * kMicrosecondsPerMillisecond; |
265 SleepMicros(micros); | 274 SleepMicros(micros); |
266 } | 275 } |
267 | 276 |
268 | 277 |
269 void OS::SleepMicros(int64_t micros) { | 278 void OS::SleepMicros(int64_t micros) { |
270 struct timespec req; // requested. | 279 struct timespec req; // requested. |
271 struct timespec rem; // remainder. | 280 struct timespec rem; // remainder. |
272 int64_t seconds = micros / kMicrosecondsPerSecond; | 281 int64_t seconds = micros / kMicrosecondsPerSecond; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 } | 434 } |
426 | 435 |
427 | 436 |
428 void OS::Exit(int code) { | 437 void OS::Exit(int code) { |
429 exit(code); | 438 exit(code); |
430 } | 439 } |
431 | 440 |
432 } // namespace dart | 441 } // namespace dart |
433 | 442 |
434 #endif // defined(TARGET_OS_LINUX) | 443 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |