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

Unified Diff: base/process/process_metrics_linux.cc

Issue 2070083002: Add Linux MemAvailable to SystemMemoryInfoKB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Exclude Android and improve commenting Created 4 years, 6 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
« no previous file with comments | « base/process/process_metrics.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics_linux.cc
diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc
index 89a26090da720ba41c9b8b2ba2e393580fc0c620..3d27656d6acccaea911a1a0a8f7294c76f720c79 100644
--- a/base/process/process_metrics_linux.cc
+++ b/base/process/process_metrics_linux.cc
@@ -534,6 +534,9 @@ const size_t kDiskWeightedIOTime = 13;
SystemMemoryInfoKB::SystemMemoryInfoKB() {
total = 0;
free = 0;
+#if defined(OS_LINUX)
+ available = 0;
+#endif
buffers = 0;
cached = 0;
active_anon = 0;
@@ -564,6 +567,9 @@ std::unique_ptr<Value> SystemMemoryInfoKB::ToValue() const {
res->SetInteger("total", total);
res->SetInteger("free", free);
+#if defined(OS_LINUX)
+ res->SetInteger("available", available);
+#endif
res->SetInteger("buffers", buffers);
res->SetInteger("cached", cached);
res->SetInteger("active_anon", active_anon);
@@ -621,6 +627,10 @@ bool ParseProcMeminfo(const std::string& meminfo_data,
target = &meminfo->total;
else if (tokens[0] == "MemFree:")
target = &meminfo->free;
+#if defined(OS_LINUX)
+ else if (tokens[0] == "MemAvailable:")
+ target = &meminfo->available;
+#endif
else if (tokens[0] == "Buffers:")
target = &meminfo->buffers;
else if (tokens[0] == "Cached:")
« no previous file with comments | « base/process/process_metrics.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698