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_LINUX) | 6 #if defined(HOST_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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 ASSERT(Utils::IsPowerOfTwo(alignment)); | 214 ASSERT(Utils::IsPowerOfTwo(alignment)); |
215 ASSERT(alignment >= kMinimumAlignment); | 215 ASSERT(alignment >= kMinimumAlignment); |
216 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); | 216 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); |
217 return alignment; | 217 return alignment; |
218 } | 218 } |
219 | 219 |
220 int OS::NumberOfAvailableProcessors() { | 220 int OS::NumberOfAvailableProcessors() { |
221 return sysconf(_SC_NPROCESSORS_ONLN); | 221 return sysconf(_SC_NPROCESSORS_ONLN); |
222 } | 222 } |
223 | 223 |
| 224 uintptr_t OS::MaxRSS() { |
| 225 struct rusage usage; |
| 226 usage.ru_maxrss = 0; |
| 227 int r = getrusage(RUSAGE_SELF, &usage); |
| 228 ASSERT(r == 0); |
| 229 return usage.ru_maxrss * KB; |
| 230 } |
| 231 |
224 void OS::Sleep(int64_t millis) { | 232 void OS::Sleep(int64_t millis) { |
225 int64_t micros = millis * kMicrosecondsPerMillisecond; | 233 int64_t micros = millis * kMicrosecondsPerMillisecond; |
226 SleepMicros(micros); | 234 SleepMicros(micros); |
227 } | 235 } |
228 | 236 |
229 void OS::SleepMicros(int64_t micros) { | 237 void OS::SleepMicros(int64_t micros) { |
230 struct timespec req; // requested. | 238 struct timespec req; // requested. |
231 struct timespec rem; // remainder. | 239 struct timespec rem; // remainder. |
232 int64_t seconds = micros / kMicrosecondsPerSecond; | 240 int64_t seconds = micros / kMicrosecondsPerSecond; |
233 micros = micros - seconds * kMicrosecondsPerSecond; | 241 micros = micros - seconds * kMicrosecondsPerSecond; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 abort(); | 381 abort(); |
374 } | 382 } |
375 | 383 |
376 void OS::Exit(int code) { | 384 void OS::Exit(int code) { |
377 exit(code); | 385 exit(code); |
378 } | 386 } |
379 | 387 |
380 } // namespace dart | 388 } // namespace dart |
381 | 389 |
382 #endif // defined(HOST_OS_LINUX) | 390 #endif // defined(HOST_OS_LINUX) |
OLD | NEW |