summaryrefslogtreecommitdiff
path: root/memory_replay
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-08-07 14:31:25 -0700
committerChristopher Ferris <cferris@google.com>2019-08-07 14:31:25 -0700
commit5140415c9810a13e441cd97b762372082357f4ba (patch)
tree2b4d0af30b4073a7d0689f359e530a909a63028c /memory_replay
parentfe6f4fa2ad6b3a0dc8855797f5850fa6322cee24 (diff)
downloadextras-5140415c9810a13e441cd97b762372082357f4ba.tar.gz
Change from PSS to RSS.
In practice, PSS and RSS should be the same for this test, but what we are really measuring is RSS, so display it as such. Bug: 138394907 Test: Ran memory_replay32/64 and verified that new RSS is the same as Test: old version that used PSS. Change-Id: Ida92e4551f5b58729cd699bc9a296d324483daae
Diffstat (limited to 'memory_replay')
-rw-r--r--memory_replay/NativeInfo.cpp18
-rw-r--r--memory_replay/NativeInfo.h2
-rw-r--r--memory_replay/Pointers.cpp2
3 files changed, 11 insertions, 11 deletions
diff --git a/memory_replay/NativeInfo.cpp b/memory_replay/NativeInfo.cpp
index 18c832bb..2db653cb 100644
--- a/memory_replay/NativeInfo.cpp
+++ b/memory_replay/NativeInfo.cpp
@@ -32,18 +32,18 @@
// This function is not re-entrant since it uses a static buffer for
// the line data.
-void GetNativeInfo(int smaps_fd, size_t* pss_bytes, size_t* va_bytes) {
+void GetNativeInfo(int smaps_fd, size_t* rss_bytes, size_t* va_bytes) {
static char map_buffer[65535];
LineBuffer line_buf(smaps_fd, map_buffer, sizeof(map_buffer));
char* line;
- size_t total_pss_bytes = 0;
+ size_t total_rss_bytes = 0;
size_t total_va_bytes = 0;
size_t line_len;
bool native_map = false;
while (line_buf.GetLine(&line, &line_len)) {
uintptr_t start, end;
int name_pos;
- size_t native_pss_kB;
+ size_t native_rss_kB;
if (sscanf(line, "%" SCNxPTR "-%" SCNxPTR " %*4s %*x %*x:%*x %*d %n",
&start, &end, &name_pos) == 2) {
if (strcmp(line + name_pos, "[anon:libc_malloc]") == 0 ||
@@ -53,16 +53,16 @@ void GetNativeInfo(int smaps_fd, size_t* pss_bytes, size_t* va_bytes) {
} else {
native_map = false;
}
- } else if (native_map && sscanf(line, "Pss: %zu", &native_pss_kB) == 1) {
- total_pss_bytes += native_pss_kB * 1024;
+ } else if (native_map && sscanf(line, "Rss: %zu", &native_rss_kB) == 1) {
+ total_rss_bytes += native_rss_kB * 1024;
}
}
- *pss_bytes = total_pss_bytes;
+ *rss_bytes = total_rss_bytes;
*va_bytes = total_va_bytes;
}
void PrintNativeInfo(const char* preamble) {
- size_t pss_bytes;
+ size_t rss_bytes;
size_t va_bytes;
android::base::unique_fd smaps_fd(open("/proc/self/smaps", O_RDONLY));
@@ -70,8 +70,8 @@ void PrintNativeInfo(const char* preamble) {
err(1, "Cannot open /proc/self/smaps: %s\n", strerror(errno));
}
- GetNativeInfo(smaps_fd, &pss_bytes, &va_bytes);
- printf("%sNative PSS: %zu bytes %0.2fMB\n", preamble, pss_bytes, pss_bytes/(1024*1024.0));
+ GetNativeInfo(smaps_fd, &rss_bytes, &va_bytes);
+ printf("%sNative RSS: %zu bytes %0.2fMB\n", preamble, rss_bytes, rss_bytes/(1024*1024.0));
printf("%sNative VA Space: %zu bytes %0.2fMB\n", preamble, va_bytes, va_bytes/(1024*1024.0));
fflush(stdout);
}
diff --git a/memory_replay/NativeInfo.h b/memory_replay/NativeInfo.h
index 59536954..40a16f2d 100644
--- a/memory_replay/NativeInfo.h
+++ b/memory_replay/NativeInfo.h
@@ -18,7 +18,7 @@
#define _MEMORY_REPLAY_NATIVE_INFO_H
// This function is not re-entrant.
-void GetNativeInfo(int smaps_fd, size_t* pss_bytes, size_t* va_bytes);
+void GetNativeInfo(int smaps_fd, size_t* rss_bytes, size_t* va_bytes);
// This function is not re-entrant.
void PrintNativeInfo(const char* preamble);
diff --git a/memory_replay/Pointers.cpp b/memory_replay/Pointers.cpp
index b9604f06..e9eebadb 100644
--- a/memory_replay/Pointers.cpp
+++ b/memory_replay/Pointers.cpp
@@ -37,7 +37,7 @@ Pointers::Pointers(size_t max_allocs) {
if (memory == MAP_FAILED) {
err(1, "Unable to allocate data for pointer hash: %zu total_allocs\n", max_allocs);
}
- // Make sure that all of the PSS for this is counted right away.
+ // Make sure that all of the RSS for this is counted right away.
memset(memory, 0, pointers_size_);
pointers_ = reinterpret_cast<pointer_data*>(memory);
}