Don't include map name if the consumer doesn't want names.
Simpleperf doesn't need the name, so avoid the string copies.
This seems to speed up simpleperf by around 20%.
Test: backtrace_test libunwindstack_test
Change-Id: Iba064c7078f7e5ecfc9d8539ba09c14495a52158
diff --git a/libunwindstack/Unwinder.cpp b/libunwindstack/Unwinder.cpp
index 94edb1c..27262bd 100644
--- a/libunwindstack/Unwinder.cpp
+++ b/libunwindstack/Unwinder.cpp
@@ -61,7 +61,9 @@
frame->map_offset = info->offset;
frame->map_load_bias = info->load_bias;
frame->map_flags = info->flags;
- frame->map_name = info->name;
+ if (resolve_names_) {
+ frame->map_name = info->name;
+ }
frame->rel_pc = dex_pc - info->start;
} else {
frame->rel_pc = dex_pc;
@@ -96,7 +98,9 @@
return;
}
- frame->map_name = map_info->name;
+ if (resolve_names_) {
+ frame->map_name = map_info->name;
+ }
frame->map_offset = map_info->offset;
frame->map_start = map_info->start;
frame->map_end = map_info->end;