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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/os_fuchsia.cc
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index 10e2640e922a7e6815ac38b1382d96088c88fc9b..72f854846d78276aca3dabae1b9d69502aa7b0e4 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -8,7 +8,9 @@
#include "vm/os.h"
#include <errno.h>
+#include <magenta/process.h>
#include <magenta/syscalls.h>
+#include <magenta/syscalls/object.h>
#include <magenta/types.h>
#include "platform/assert.h"
@@ -156,8 +158,11 @@ int OS::NumberOfAvailableProcessors() {
uintptr_t OS::MaxRSS() {
- // TODO(US-95): Implement.
- return 0;
+ mx_info_task_stats_t task_stats;
+ mx_handle_t process = mx_process_self();
+ mx_status_t status = mx_object_get_info(
+ process, MX_INFO_TASK_STATS, &task_stats, sizeof(task_stats), NULL, NULL);
+ return (status == NO_ERROR) ? task_stats.mem_committed_bytes : 0;
}

Powered by Google App Engine
This is Rietveld 408576698