diff options
author | David Srbecky | 2018-03-16 13:44:04 -0500 |
---|---|---|
committer | David Srbecky | 2018-03-19 06:20:00 -0500 |
commit | e62f4c4d4c016322bda7f17f7111d3f7d4d35dc8 (patch) | |
tree | f005c26e51f808bc59b042311321ecf2cc09f825 /libunwindstack | |
parent | 6fe59afe53b2cd791935e27338dd994f9fd9a319 (diff) | |
download | platform-system-core-e62f4c4d4c016322bda7f17f7111d3f7d4d35dc8.tar.gz platform-system-core-e62f4c4d4c016322bda7f17f7111d3f7d4d35dc8.tar.xz platform-system-core-e62f4c4d4c016322bda7f17f7111d3f7d4d35dc8.zip |
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
Diffstat (limited to 'libunwindstack')
-rw-r--r-- | libunwindstack/Unwinder.cpp | 8 | ||||
-rw-r--r-- | libunwindstack/tests/UnwinderTest.cpp | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/libunwindstack/Unwinder.cpp b/libunwindstack/Unwinder.cpp index 94edb1cc8..27262bd5b 100644 --- a/libunwindstack/Unwinder.cpp +++ b/libunwindstack/Unwinder.cpp | |||
@@ -61,7 +61,9 @@ void Unwinder::FillInDexFrame() { | |||
61 | frame->map_offset = info->offset; | 61 | frame->map_offset = info->offset; |
62 | frame->map_load_bias = info->load_bias; | 62 | frame->map_load_bias = info->load_bias; |
63 | frame->map_flags = info->flags; | 63 | frame->map_flags = info->flags; |
64 | frame->map_name = info->name; | 64 | if (resolve_names_) { |
65 | frame->map_name = info->name; | ||
66 | } | ||
65 | frame->rel_pc = dex_pc - info->start; | 67 | frame->rel_pc = dex_pc - info->start; |
66 | } else { | 68 | } else { |
67 | frame->rel_pc = dex_pc; | 69 | frame->rel_pc = dex_pc; |
@@ -96,7 +98,9 @@ void Unwinder::FillInFrame(MapInfo* map_info, Elf* elf, uint64_t rel_pc, uint64_ | |||
96 | return; | 98 | return; |
97 | } | 99 | } |
98 | 100 | ||
99 | frame->map_name = map_info->name; | 101 | if (resolve_names_) { |
102 | frame->map_name = map_info->name; | ||
103 | } | ||
100 | frame->map_offset = map_info->offset; | 104 | frame->map_offset = map_info->offset; |
101 | frame->map_start = map_info->start; | 105 | frame->map_start = map_info->start; |
102 | frame->map_end = map_info->end; | 106 | frame->map_end = map_info->end; |
diff --git a/libunwindstack/tests/UnwinderTest.cpp b/libunwindstack/tests/UnwinderTest.cpp index e44b225c5..551f46c7b 100644 --- a/libunwindstack/tests/UnwinderTest.cpp +++ b/libunwindstack/tests/UnwinderTest.cpp | |||
@@ -221,7 +221,7 @@ TEST_F(UnwinderTest, multiple_frames_dont_resolve_names) { | |||
221 | EXPECT_EQ(0x10000U, frame->sp); | 221 | EXPECT_EQ(0x10000U, frame->sp); |
222 | EXPECT_EQ("", frame->function_name); | 222 | EXPECT_EQ("", frame->function_name); |
223 | EXPECT_EQ(0U, frame->function_offset); | 223 | EXPECT_EQ(0U, frame->function_offset); |
224 | EXPECT_EQ("/system/fake/libc.so", frame->map_name); | 224 | EXPECT_EQ("", frame->map_name); |
225 | EXPECT_EQ(0U, frame->map_offset); | 225 | EXPECT_EQ(0U, frame->map_offset); |
226 | EXPECT_EQ(0x1000U, frame->map_start); | 226 | EXPECT_EQ(0x1000U, frame->map_start); |
227 | EXPECT_EQ(0x8000U, frame->map_end); | 227 | EXPECT_EQ(0x8000U, frame->map_end); |
@@ -235,7 +235,7 @@ TEST_F(UnwinderTest, multiple_frames_dont_resolve_names) { | |||
235 | EXPECT_EQ(0x10010U, frame->sp); | 235 | EXPECT_EQ(0x10010U, frame->sp); |
236 | EXPECT_EQ("", frame->function_name); | 236 | EXPECT_EQ("", frame->function_name); |
237 | EXPECT_EQ(0U, frame->function_offset); | 237 | EXPECT_EQ(0U, frame->function_offset); |
238 | EXPECT_EQ("/system/fake/libc.so", frame->map_name); | 238 | EXPECT_EQ("", frame->map_name); |
239 | EXPECT_EQ(0U, frame->map_offset); | 239 | EXPECT_EQ(0U, frame->map_offset); |
240 | EXPECT_EQ(0x1000U, frame->map_start); | 240 | EXPECT_EQ(0x1000U, frame->map_start); |
241 | EXPECT_EQ(0x8000U, frame->map_end); | 241 | EXPECT_EQ(0x8000U, frame->map_end); |
@@ -249,7 +249,7 @@ TEST_F(UnwinderTest, multiple_frames_dont_resolve_names) { | |||
249 | EXPECT_EQ(0x10020U, frame->sp); | 249 | EXPECT_EQ(0x10020U, frame->sp); |
250 | EXPECT_EQ("", frame->function_name); | 250 | EXPECT_EQ("", frame->function_name); |
251 | EXPECT_EQ(0U, frame->function_offset); | 251 | EXPECT_EQ(0U, frame->function_offset); |
252 | EXPECT_EQ("/system/fake/libc.so", frame->map_name); | 252 | EXPECT_EQ("", frame->map_name); |
253 | EXPECT_EQ(0U, frame->map_offset); | 253 | EXPECT_EQ(0U, frame->map_offset); |
254 | EXPECT_EQ(0x1000U, frame->map_start); | 254 | EXPECT_EQ(0x1000U, frame->map_start); |
255 | EXPECT_EQ(0x8000U, frame->map_end); | 255 | EXPECT_EQ(0x8000U, frame->map_end); |