From 89b658c2659911cfcb1020b5fda83f0e9accd025 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Thu, 10 Oct 2019 13:27:54 -0700 Subject: [PATCH] Only get stats for relevant maps. Scudo creates a large map on 64 bit which can cause a slow down trying to get the usage stats for all maps. Since the test only really cares about a small subset of maps, only get the usage stats for those maps. Test: Ran unit tests on scudo and jemalloc based systems. Change-Id: Iba3cff1487ca304083aac323a3971b9f939f5c11 --- tests/dlext_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp index e7274f704..e98d66ffd 100644 --- a/tests/dlext_test.cpp +++ b/tests/dlext_test.cpp @@ -600,7 +600,7 @@ TEST_F(DlExtRelroSharingTest, VerifyMemorySaving) { void GetPss(bool shared_relro, const char* lib, const char* relro_file, pid_t pid, size_t* total_pss) { android::meminfo::ProcMemInfo proc_mem(pid); - const std::vector& maps = proc_mem.Maps(); + const std::vector& maps = proc_mem.MapsWithoutUsageStats(); ASSERT_GT(maps.size(), 0UL); // Calculate total PSS of the library. @@ -612,7 +612,9 @@ void GetPss(bool shared_relro, const char* lib, const char* relro_file, pid_t pi saw_relro_file = true; } - *total_pss += vma.usage.pss; + android::meminfo::Vma update_vma(vma); + ASSERT_TRUE(proc_mem.FillInVmaStats(update_vma)); + *total_pss += update_vma.usage.pss; } }