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

Unified Diff: base/process/process_metrics.cc

Issue 23155002: Implement ToValue() for SystemMetrics, SystemMemoryInfoKB, DiskInfo, and SwapInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@meminfo
Patch Set: removing rate stats, compute them later Created 7 years, 4 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: base/process/process_metrics.cc
diff --git a/base/process/process_metrics.cc b/base/process/process_metrics.cc
index 965aaab3010934e88fe1c36c39d97eee767c38c7..0d1ee12acae9f2588057b53db62714fe861c7b2e 100644
--- a/base/process/process_metrics.cc
+++ b/base/process/process_metrics.cc
@@ -25,4 +25,21 @@ SystemMetrics SystemMetrics::Sample() {
return system_metrics;
}
+Value* SystemMetrics::AsValue() const {
+ DictionaryValue* res = new base::DictionaryValue();
+
+ res->SetInteger("committed_memory", committed_memory_);
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+ res->Set("meminfo", memory_info_.AsValue());
+#endif
+#if defined(OS_LINUX)
+ res->Set("diskinfo", disk_info_.AsValue());
+#endif
+#if defined(OS_CHROMEOS)
+ res->Set("swapinfo", swap_info_.AsValue());
+#endif
+
+ return res;
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698