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 | |
232 void OS::Sleep(int64_t millis) { | 224 void OS::Sleep(int64_t millis) { |
233 int64_t micros = millis * kMicrosecondsPerMillisecond; | 225 int64_t micros = millis * kMicrosecondsPerMillisecond; |
234 SleepMicros(micros); | 226 SleepMicros(micros); |
235 } | 227 } |
236 | 228 |
237 void OS::SleepMicros(int64_t micros) { | 229 void OS::SleepMicros(int64_t micros) { |
238 struct timespec req; // requested. | 230 struct timespec req; // requested. |
239 struct timespec rem; // remainder. | 231 struct timespec rem; // remainder. |
240 int64_t seconds = micros / kMicrosecondsPerSecond; | 232 int64_t seconds = micros / kMicrosecondsPerSecond; |
241 micros = micros - seconds * kMicrosecondsPerSecond; | 233 micros = micros - seconds * kMicrosecondsPerSecond; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 abort(); | 373 abort(); |
382 } | 374 } |
383 | 375 |
384 void OS::Exit(int code) { | 376 void OS::Exit(int code) { |
385 exit(code); | 377 exit(code); |
386 } | 378 } |
387 | 379 |
388 } // namespace dart | 380 } // namespace dart |
389 | 381 |
390 #endif // defined(HOST_OS_LINUX) | 382 #endif // defined(HOST_OS_LINUX) |
OLD | NEW |