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
This commit is contained in:
Christopher Ferris 2019-10-10 13:27:54 -07:00
parent 87a10ac108
commit 89b658c265

View file

@ -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<android::meminfo::Vma>& maps = proc_mem.Maps();
const std::vector<android::meminfo::Vma>& 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;
}
}