OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 6 #if defined(HOST_OS_FUCHSIA) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
| 11 #include <magenta/process.h> |
11 #include <magenta/syscalls.h> | 12 #include <magenta/syscalls.h> |
| 13 #include <magenta/syscalls/object.h> |
12 #include <magenta/types.h> | 14 #include <magenta/types.h> |
13 | 15 |
14 #include "platform/assert.h" | 16 #include "platform/assert.h" |
15 #include "vm/zone.h" | 17 #include "vm/zone.h" |
16 | 18 |
17 namespace dart { | 19 namespace dart { |
18 | 20 |
19 #ifndef PRODUCT | 21 #ifndef PRODUCT |
20 | 22 |
21 DEFINE_FLAG(bool, | 23 DEFINE_FLAG(bool, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return false; | 151 return false; |
150 } | 152 } |
151 | 153 |
152 | 154 |
153 int OS::NumberOfAvailableProcessors() { | 155 int OS::NumberOfAvailableProcessors() { |
154 return sysconf(_SC_NPROCESSORS_CONF); | 156 return sysconf(_SC_NPROCESSORS_CONF); |
155 } | 157 } |
156 | 158 |
157 | 159 |
158 uintptr_t OS::MaxRSS() { | 160 uintptr_t OS::MaxRSS() { |
159 // TODO(US-95): Implement. | 161 mx_info_task_stats_t task_stats; |
160 return 0; | 162 mx_handle_t process = mx_process_self(); |
| 163 mx_status_t status = mx_object_get_info( |
| 164 process, MX_INFO_TASK_STATS, &task_stats, sizeof(task_stats), NULL, NULL); |
| 165 return (status == NO_ERROR) ? task_stats.mem_committed_bytes : 0; |
161 } | 166 } |
162 | 167 |
163 | 168 |
164 void OS::Sleep(int64_t millis) { | 169 void OS::Sleep(int64_t millis) { |
165 mx_nanosleep(millis * kMicrosecondsPerMillisecond * | 170 mx_nanosleep(millis * kMicrosecondsPerMillisecond * |
166 kNanosecondsPerMicrosecond); | 171 kNanosecondsPerMicrosecond); |
167 } | 172 } |
168 | 173 |
169 | 174 |
170 void OS::SleepMicros(int64_t micros) { | 175 void OS::SleepMicros(int64_t micros) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 316 } |
312 | 317 |
313 | 318 |
314 void OS::Exit(int code) { | 319 void OS::Exit(int code) { |
315 UNIMPLEMENTED(); | 320 UNIMPLEMENTED(); |
316 } | 321 } |
317 | 322 |
318 } // namespace dart | 323 } // namespace dart |
319 | 324 |
320 #endif // defined(HOST_OS_FUCHSIA) | 325 #endif // defined(HOST_OS_FUCHSIA) |
OLD | NEW |