Add API to read DMA-BUF heap total pool size
This API will read the total size of all memory pools maintained by
DMA-BUF heaps.
Bug: 167709539
Test: dumpsys meminfo
Change-Id: I379bf0dbb0bd4972be09498c00034d5e58585910
diff --git a/libmeminfo_test.cpp b/libmeminfo_test.cpp
index a041f3f..95bc535 100644
--- a/libmeminfo_test.cpp
+++ b/libmeminfo_test.cpp
@@ -865,6 +865,19 @@
EXPECT_TRUE(size >= 0);
}
+TEST(SysMemInfo, TestReadDmaBufHeapPoolsSizeKb) {
+ std::string total_pools_kb = R"total_pools_kb(416)total_pools_kb";
+ uint64_t size;
+
+ TemporaryFile tf;
+ ASSERT_TRUE(tf.fd != -1);
+ ASSERT_TRUE(::android::base::WriteStringToFd(total_pools_kb, tf.fd));
+ std::string file = std::string(tf.path);
+
+ ASSERT_TRUE(ReadDmabufHeapPoolsSizeKb(&size, file));
+ EXPECT_EQ(size, 416);
+}
+
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
::android::base::InitLogging(argv, android::base::StderrLogger);