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

Unified Diff: runtime/bin/process_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/bin/process_fuchsia.cc
diff --git a/runtime/bin/process_fuchsia.cc b/runtime/bin/process_fuchsia.cc
index 26ca132afe6f114a3f1663492827644b6c4fd530..14f3faa85e1682c9590941623bb21fc45ec7ce8a 100644
--- a/runtime/bin/process_fuchsia.cc
+++ b/runtime/bin/process_fuchsia.cc
@@ -431,6 +431,27 @@ intptr_t Process::CurrentProcessId() {
}
+int64_t Process::CurrentRSS() {
+ 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);
+ if (status != NO_ERROR) {
+ // TODO(zra): Translate this to a Unix errno.
+ errno = status;
+ return -1;
+ }
+ return task_stats.mem_committed_bytes;
+}
+
+
+int64_t Process::MaxRSS() {
+ // There is currently no way to get the high watermark value on Fuchsia, so
+ // just return the current RSS value.
+ return CurrentRSS();
+}
+
+
static bool ProcessWaitCleanup(intptr_t out,
intptr_t err,
intptr_t exit_event,

Powered by Google App Engine
This is Rietveld 408576698