libprocinfo: provide MapInfo structure for reading maps.
Bug: none
Test: run libprocinfo_test.
Change-Id: I4d3c0f3012e91571aef7ebf4b154df1c9c5addc2
diff --git a/process_map_benchmark.cpp b/process_map_benchmark.cpp
index d9e8a4d..04995d4 100644
--- a/process_map_benchmark.cpp
+++ b/process_map_benchmark.cpp
@@ -27,21 +27,10 @@
#include <benchmark/benchmark.h>
-struct MapInfo {
- uint64_t start;
- uint64_t end;
- uint16_t flags;
- uint64_t pgoff;
- const std::string name;
-
- MapInfo(uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, const char* name)
- : start(start), end(end), flags(flags), pgoff(pgoff), name(name) {}
-};
-
static void BM_ReadMapFile(benchmark::State& state) {
std::string map_file = android::base::GetExecutableDirectory() + "/testdata/maps";
for (auto _ : state) {
- std::vector<MapInfo> maps;
+ std::vector<android::procinfo::MapInfo> maps;
android::procinfo::ReadMapFile(
map_file, [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff,
const char* name) { maps.emplace_back(start, end, flags, pgoff, name); });