simpleperf: dump only needed symbols in file feature section.
Instead of dumping all symbols in the hit elf files, dump only
needed symbols can save a lot of space. To do so, read perf.data
after recording to collect hit file and symbol information.
Bug: http://b/32340274
Test: test using `simpleperf record --dump-symbols` manually.
Test: run simpleperf_unit_test.
Change-Id: I480f3e2e7ccebfbb5df16a597724f5f40d62c821
diff --git a/simpleperf/dso.h b/simpleperf/dso.h
index 75290a7..17b3988 100644
--- a/simpleperf/dso.h
+++ b/simpleperf/dso.h
@@ -46,6 +46,22 @@
return true;
}
+ static bool CompareByDumpId(const Symbol* s1, const Symbol* s2) {
+ uint32_t id1 = UINT_MAX;
+ s1->GetDumpId(&id1);
+ uint32_t id2 = UINT_MAX;
+ s2->GetDumpId(&id2);
+ return id1 < id2;
+ }
+
+ static bool CompareByAddr(const Symbol* s1, const Symbol* s2) {
+ return s1->addr < s2->addr;
+ }
+
+ static bool CompareValueByAddr(const Symbol& s1, const Symbol& s2) {
+ return s1.addr < s2.addr;
+ }
+
private:
const char* name_;
mutable const char* demangled_name_;