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

Unified Diff: base/process/process_metrics_linux.cc

Issue 2766623002: Revert of Fix free memory calculation. (Closed)
Patch Set: Created 3 years, 9 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_ios.cc ('k') | base/process/process_metrics_mac.cc » ('j') | 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 114deda49e390bc73b13e68a5aa6abdbb09f6ccb..b14aa210bd57af5bd53c6581590fa221f355d9bb 100644
--- a/base/process/process_metrics_linux.cc
+++ b/base/process/process_metrics_linux.cc
@@ -532,12 +532,45 @@
} // namespace
+SystemMemoryInfoKB::SystemMemoryInfoKB() {
+ total = 0;
+ free = 0;
+#if defined(OS_LINUX)
+ available = 0;
+#endif
+ buffers = 0;
+ cached = 0;
+ active_anon = 0;
+ inactive_anon = 0;
+ active_file = 0;
+ inactive_file = 0;
+ swap_total = 0;
+ swap_free = 0;
+ dirty = 0;
+
+ pswpin = 0;
+ pswpout = 0;
+ pgmajfault = 0;
+
+#ifdef OS_CHROMEOS
+ shmem = 0;
+ slab = 0;
+ gem_objects = -1;
+ gem_size = -1;
+#endif
+}
+
+SystemMemoryInfoKB::SystemMemoryInfoKB(const SystemMemoryInfoKB& other) =
+ default;
+
std::unique_ptr<Value> SystemMemoryInfoKB::ToValue() const {
std::unique_ptr<DictionaryValue> res(new DictionaryValue());
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);
@@ -548,7 +581,6 @@
res->SetInteger("swap_free", swap_free);
res->SetInteger("swap_used", swap_total - swap_free);
res->SetInteger("dirty", dirty);
- res->SetInteger("reclaimable", reclaimable);
res->SetInteger("pswpin", pswpin);
res->SetInteger("pswpout", pswpout);
res->SetInteger("pgmajfault", pgmajfault);
@@ -596,8 +628,10 @@
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:")
@@ -616,8 +650,6 @@
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.
« no previous file with comments | « base/process/process_metrics_ios.cc ('k') | base/process/process_metrics_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698