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

Unified Diff: base/process/process_metrics_linux.cc

Issue 2558043007: Fix free memory calculation. (Closed)
Patch Set: Fix comment formatting. Created 3 years, 10 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_linux.cc
diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc
index b14aa210bd57af5bd53c6581590fa221f355d9bb..bae922ac6944f974094da2bdb7bc9f99f95a3143 100644
--- a/base/process/process_metrics_linux.cc
+++ b/base/process/process_metrics_linux.cc
@@ -535,7 +535,7 @@ const size_t kDiskWeightedIOTime = 13;
SystemMemoryInfoKB::SystemMemoryInfoKB() {
total = 0;
free = 0;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_ANDROID)
Primiano Tucci (use gerrit) 2017/02/15 11:18:33 i think you can ditch the ifdef at this point, can
Michael K. (Yandex Team) 2017/02/17 13:38:48 Done.
available = 0;
#endif
buffers = 0;
@@ -547,6 +547,7 @@ SystemMemoryInfoKB::SystemMemoryInfoKB() {
swap_total = 0;
swap_free = 0;
dirty = 0;
+ reclaimable = 0;
pswpin = 0;
pswpout = 0;
@@ -568,7 +569,7 @@ std::unique_ptr<Value> SystemMemoryInfoKB::ToValue() const {
res->SetInteger("total", total);
res->SetInteger("free", free);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_ANDROID)
Primiano Tucci (use gerrit) 2017/02/15 11:18:33 ditto, here an below
Michael K. (Yandex Team) 2017/02/17 13:38:48 Done.
res->SetInteger("available", available);
#endif
res->SetInteger("buffers", buffers);
@@ -628,7 +629,7 @@ bool ParseProcMeminfo(const std::string& meminfo_data,
target = &meminfo->total;
else if (tokens[0] == "MemFree:")
target = &meminfo->free;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_ANDROID)
else if (tokens[0] == "MemAvailable:")
target = &meminfo->available;
#endif
@@ -650,6 +651,8 @@ bool ParseProcMeminfo(const std::string& meminfo_data,
target = &meminfo->swap_free;
else if (tokens[0] == "Dirty:")
target = &meminfo->dirty;
+ else if (tokens[0] == "SReclaimable:")
+ target = &meminfo->reclaimable;
#if defined(OS_CHROMEOS)
// Chrome OS has a tweaked kernel that allows us to query Shmem, which is
// usually video memory otherwise invisible to the OS.

Powered by Google App Engine
This is Rietveld 408576698