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

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: cleanup 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 fae633717e47d2419969c35397fc84e1372ca074..0a48bfdfb5710da68a7814c21e47ed5b0efe7242 100644
--- a/base/process/process_metrics.cc
+++ b/base/process/process_metrics.cc
@@ -12,11 +12,26 @@ SystemMetrics SystemMetrics::GetCurrent() {
SystemMetrics system_metrics;
system_metrics.committed_memory_ = GetSystemCommitCharge();
-#if defined(OS_LINUX) || defined(OS_ANDROID)
GetSystemMemoryInfo(&system_metrics.memory_info_);
+ GetSystemDiskInfo(&system_metrics.disk_info_);
+#ifdef OS_CHROMEOS
+ GetSwapInfo(&system_metrics.swap_info_);
#endif
return system_metrics;
}
+Value* SystemMetrics::AsValue() const {
+ DictionaryValue* res = new base::DictionaryValue();
+
+ res->SetInteger("committed_memory", committed_memory_);
+ res->Set("meminfo", memory_info_.AsValue());
+ res->Set("diskinfo", disk_info_.AsValue());
+#ifdef OS_CHROMEOS
+ res->Set("swapinfo", swap_info_.AsValue());
+#endif
+
+ return res;
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698