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

Unified Diff: runtime/bin/process_win.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_win.cc
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc
index 56cd57d6b164b57539d914f76217e742a804f343..95f9cd34ad13f4c1bbc959568c9d9347ebed7d70 100644
--- a/runtime/bin/process_win.cc
+++ b/runtime/bin/process_win.cc
@@ -9,6 +9,7 @@
#include "bin/process.h"
+#include <psapi.h> // NOLINT
#include <process.h> // NOLINT
#include "bin/builtin.h"
@@ -941,6 +942,24 @@ intptr_t Process::CurrentProcessId() {
}
+int64_t Process::CurrentRSS() {
+ PROCESS_MEMORY_COUNTERS pmc;
+ if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
+ return -1;
+ }
+ return pmc.WorkingSetSize;
+}
+
+
+int64_t Process::MaxRSS() {
+ PROCESS_MEMORY_COUNTERS pmc;
+ if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
+ return -1;
+ }
+ return pmc.PeakWorkingSetSize;
+}
+
+
static SignalInfo* signal_handlers = NULL;
static Mutex* signal_mutex = new Mutex();

Powered by Google App Engine
This is Rietveld 408576698