summaryrefslogtreecommitdiffstats
path: root/libmeminfo/include
diff options
context:
space:
mode:
authorSandeep Patil <sspatil@google.com>2018-11-20 09:31:36 -0800
committerSandeep Patil <sspatil@google.com>2018-12-05 09:31:10 -0800
commitc6497eb1dc39294f017de06f97739ea7bcb964fb (patch)
treef17b2a39e75216a69adcbdccd2c0eb9e3d0f3a07 /libmeminfo/include
parentf12919935099acefa0b3e34e2ee36db85e2165b0 (diff)
downloadsystem_core-c6497eb1dc39294f017de06f97739ea7bcb964fb.tar.gz
system_core-c6497eb1dc39294f017de06f97739ea7bcb964fb.tar.bz2
system_core-c6497eb1dc39294f017de06f97739ea7bcb964fb.zip
libmeminfo: defer maps reading only when required for procmeminfo
This restores the original behavior. The main reason it should be this way is to make the class generic for all things memory under /proc/<pid>/. For example, with the current behavior, a program that only needs to read /proc/<pid>/smaps_rollup will end up wasting time and memory by parsing /proc/<pid>/maps when the object is being constructed. Same goes for a program that only wants to reset the working set. The 'ProcMemInfo' object still retains the property that it can only be used once to read maps and the object must be destroyed + recreated to update the stats. Bug: 114325007 Bug: 111694435 Test: libmeminfo_test 1 Test: # adb push /google/data/ro/users/ss/sspatil/test-memutils.sh /data/local/tmp/ # adb push procmem2 /data/local/tmp && adb push procrank2 /data/local/tmp # adb root && adb shell $ cd /data/local/tmp/ $ chmod +x test-memutils.sh $ ./test-memutils.sh 2>&1 | tee test.log Change-Id: I856d3b78a0088cff02cbd010b29ffbe0e35f5ee2 Signed-off-by: Sandeep Patil <sspatil@google.com>
Diffstat (limited to 'libmeminfo/include')
-rw-r--r--libmeminfo/include/meminfo/procmeminfo.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libmeminfo/include/meminfo/procmeminfo.h b/libmeminfo/include/meminfo/procmeminfo.h
index 0d6f652ab..92375d31c 100644
--- a/libmeminfo/include/meminfo/procmeminfo.h
+++ b/libmeminfo/include/meminfo/procmeminfo.h
@@ -37,7 +37,7 @@ class ProcMemInfo final {
const std::vector<Vma>& Maps();
const MemUsage& Usage();
const MemUsage& Wss();
- const std::vector<uint16_t>& SwapOffsets() const;
+ const std::vector<uint16_t>& SwapOffsets();
~ProcMemInfo() = default;