Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: runtime/vm/os_fuchsia.cc

Issue 2822943002: [dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia. (Closed)
Patch Set: Fix Fuchsia build Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 SleepMicros(millis * kMicrosecondsPerMillisecond); 170 SleepMicros(millis * kMicrosecondsPerMillisecond);
166 } 171 }
167 172
168 173
169 void OS::SleepMicros(int64_t micros) { 174 void OS::SleepMicros(int64_t micros) {
170 mx_nanosleep(mx_deadline_after(micros * kNanosecondsPerMicrosecond)); 175 mx_nanosleep(mx_deadline_after(micros * kNanosecondsPerMicrosecond));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 315 }
311 316
312 317
313 void OS::Exit(int code) { 318 void OS::Exit(int code) {
314 UNIMPLEMENTED(); 319 UNIMPLEMENTED();
315 } 320 }
316 321
317 } // namespace dart 322 } // namespace dart
318 323
319 #endif // defined(HOST_OS_FUCHSIA) 324 #endif // defined(HOST_OS_FUCHSIA)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698