Skip to content

Commit 2a704fc

Browse files
milianwacmel
authored andcommitted
perf report: Remove code to handle inline frames from browsers
The follow-up commits will make inline frames first-class citizens in the callchain, thereby obsoleting all of this special code. Signed-off-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Jiri Olsa <jolsa@redhat.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Yao Jin <yao.jin@linux.intel.com> Link: http://lkml.kernel.org/r/20171009203310.17362-2-milian.wolff@kdab.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 9b7c854 commit 2a704fc

5 files changed

Lines changed: 13 additions & 282 deletions

File tree

‎tools/perf/ui/browsers/hists.c‎

Lines changed: 12 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -154,57 +154,9 @@ static void callchain_list__set_folding(struct callchain_list *cl, bool unfold)
154154
cl->unfolded = unfold ? cl->has_children : false;
155155
}
156156

157-
static struct inline_node *inline_node__create(struct map *map, u64 ip)
158-
{
159-
struct dso *dso;
160-
struct inline_node *node;
161-
162-
if (map == NULL)
163-
return NULL;
164-
165-
dso = map->dso;
166-
if (dso == NULL)
167-
return NULL;
168-
169-
node = dso__parse_addr_inlines(dso,
170-
map__rip_2objdump(map, ip));
171-
172-
return node;
173-
}
174-
175-
static int inline__count_rows(struct inline_node *node)
176-
{
177-
struct inline_list *ilist;
178-
int i = 0;
179-
180-
if (node == NULL)
181-
return 0;
182-
183-
list_for_each_entry(ilist, &node->val, list) {
184-
if ((ilist->filename != NULL) || (ilist->funcname != NULL))
185-
i++;
186-
}
187-
188-
return i;
189-
}
190-
191-
static int callchain_list__inline_rows(struct callchain_list *chain)
192-
{
193-
struct inline_node *node;
194-
int rows;
195-
196-
node = inline_node__create(chain->ms.map, chain->ip);
197-
if (node == NULL)
198-
return 0;
199-
200-
rows = inline__count_rows(node);
201-
inline_node__delete(node);
202-
return rows;
203-
}
204-
205157
static int callchain_node__count_rows_rb_tree(struct callchain_node *node)
206158
{
207-
int n = 0, inline_rows;
159+
int n = 0;
208160
struct rb_node *nd;
209161

210162
for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) {
@@ -215,12 +167,6 @@ static int callchain_node__count_rows_rb_tree(struct callchain_node *node)
215167
list_for_each_entry(chain, &child->val, list) {
216168
++n;
217169

218-
if (symbol_conf.inline_name) {
219-
inline_rows =
220-
callchain_list__inline_rows(chain);
221-
n += inline_rows;
222-
}
223-
224170
/* We need this because we may not have children */
225171
folded_sign = callchain_list__folded(chain);
226172
if (folded_sign == '+')
@@ -272,7 +218,7 @@ static int callchain_node__count_rows(struct callchain_node *node)
272218
{
273219
struct callchain_list *chain;
274220
bool unfolded = false;
275-
int n = 0, inline_rows;
221+
int n = 0;
276222

277223
if (callchain_param.mode == CHAIN_FLAT)
278224
return callchain_node__count_flat_rows(node);
@@ -281,10 +227,6 @@ static int callchain_node__count_rows(struct callchain_node *node)
281227

282228
list_for_each_entry(chain, &node->val, list) {
283229
++n;
284-
if (symbol_conf.inline_name) {
285-
inline_rows = callchain_list__inline_rows(chain);
286-
n += inline_rows;
287-
}
288230

289231
unfolded = chain->unfolded;
290232
}
@@ -432,19 +374,6 @@ static void hist_entry__init_have_children(struct hist_entry *he)
432374
he->init_have_children = true;
433375
}
434376

435-
static void hist_entry_init_inline_node(struct hist_entry *he)
436-
{
437-
if (he->inline_node)
438-
return;
439-
440-
he->inline_node = inline_node__create(he->ms.map, he->ip);
441-
442-
if (he->inline_node == NULL)
443-
return;
444-
445-
he->has_children = true;
446-
}
447-
448377
static bool hist_browser__toggle_fold(struct hist_browser *browser)
449378
{
450379
struct hist_entry *he = browser->he_selection;
@@ -476,12 +405,8 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser)
476405

477406
if (he->unfolded) {
478407
if (he->leaf)
479-
if (he->inline_node)
480-
he->nr_rows = inline__count_rows(
481-
he->inline_node);
482-
else
483-
he->nr_rows = callchain__count_rows(
484-
&he->sorted_chain);
408+
he->nr_rows = callchain__count_rows(
409+
&he->sorted_chain);
485410
else
486411
he->nr_rows = hierarchy_count_rows(browser, he, false);
487412

@@ -841,71 +766,6 @@ static bool hist_browser__check_dump_full(struct hist_browser *browser __maybe_u
841766

842767
#define LEVEL_OFFSET_STEP 3
843768

844-
static int hist_browser__show_inline(struct hist_browser *browser,
845-
struct inline_node *node,
846-
unsigned short row,
847-
int offset)
848-
{
849-
struct inline_list *ilist;
850-
char buf[1024];
851-
int color, width, first_row;
852-
853-
first_row = row;
854-
width = browser->b.width - (LEVEL_OFFSET_STEP + 2);
855-
list_for_each_entry(ilist, &node->val, list) {
856-
if ((ilist->filename != NULL) || (ilist->funcname != NULL)) {
857-
color = HE_COLORSET_NORMAL;
858-
if (ui_browser__is_current_entry(&browser->b, row))
859-
color = HE_COLORSET_SELECTED;
860-
861-
if (callchain_param.key == CCKEY_ADDRESS ||
862-
callchain_param.key == CCKEY_SRCLINE) {
863-
if (ilist->filename != NULL)
864-
scnprintf(buf, sizeof(buf),
865-
"%s:%d (inline)",
866-
ilist->filename,
867-
ilist->line_nr);
868-
else
869-
scnprintf(buf, sizeof(buf), "??");
870-
} else if (ilist->funcname != NULL)
871-
scnprintf(buf, sizeof(buf), "%s (inline)",
872-
ilist->funcname);
873-
else if (ilist->filename != NULL)
874-
scnprintf(buf, sizeof(buf),
875-
"%s:%d (inline)",
876-
ilist->filename,
877-
ilist->line_nr);
878-
else
879-
scnprintf(buf, sizeof(buf), "??");
880-
881-
ui_browser__set_color(&browser->b, color);
882-
hist_browser__gotorc(browser, row, 0);
883-
ui_browser__write_nstring(&browser->b, " ",
884-
LEVEL_OFFSET_STEP + offset);
885-
ui_browser__write_nstring(&browser->b, buf, width);
886-
row++;
887-
}
888-
}
889-
890-
return row - first_row;
891-
}
892-
893-
static size_t show_inline_list(struct hist_browser *browser, struct map *map,
894-
u64 ip, int row, int offset)
895-
{
896-
struct inline_node *node;
897-
int ret;
898-
899-
node = inline_node__create(map, ip);
900-
if (node == NULL)
901-
return 0;
902-
903-
ret = hist_browser__show_inline(browser, node, row, offset);
904-
905-
inline_node__delete(node);
906-
return ret;
907-
}
908-
909769
static int hist_browser__show_callchain_list(struct hist_browser *browser,
910770
struct callchain_node *node,
911771
struct callchain_list *chain,
@@ -917,7 +777,7 @@ static int hist_browser__show_callchain_list(struct hist_browser *browser,
917777
char bf[1024], *alloc_str;
918778
char buf[64], *alloc_str2;
919779
const char *str;
920-
int inline_rows = 0, ret = 1;
780+
int ret = 1;
921781

922782
if (arg->row_offset != 0) {
923783
arg->row_offset--;
@@ -954,12 +814,7 @@ static int hist_browser__show_callchain_list(struct hist_browser *browser,
954814
free(alloc_str);
955815
free(alloc_str2);
956816

957-
if (symbol_conf.inline_name) {
958-
inline_rows = show_inline_list(browser, chain->ms.map,
959-
chain->ip, row + 1, offset);
960-
}
961-
962-
return ret + inline_rows;
817+
return ret;
963818
}
964819

965820
static bool check_percent_display(struct rb_node *node, u64 parent_total)
@@ -1383,12 +1238,6 @@ static int hist_browser__show_entry(struct hist_browser *browser,
13831238
folded_sign = hist_entry__folded(entry);
13841239
}
13851240

1386-
if (symbol_conf.inline_name &&
1387-
(!entry->has_children)) {
1388-
hist_entry_init_inline_node(entry);
1389-
folded_sign = hist_entry__folded(entry);
1390-
}
1391-
13921241
if (row_offset == 0) {
13931242
struct hpp_arg arg = {
13941243
.b = &browser->b,
@@ -1420,8 +1269,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,
14201269
}
14211270

14221271
if (first) {
1423-
if (symbol_conf.use_callchain ||
1424-
symbol_conf.inline_name) {
1272+
if (symbol_conf.use_callchain) {
14251273
ui_browser__printf(&browser->b, "%c ", folded_sign);
14261274
width -= 2;
14271275
}
@@ -1463,15 +1311,11 @@ static int hist_browser__show_entry(struct hist_browser *browser,
14631311
.is_current_entry = current_entry,
14641312
};
14651313

1466-
if (entry->inline_node)
1467-
printed += hist_browser__show_inline(browser,
1468-
entry->inline_node, row, 0);
1469-
else
1470-
printed += hist_browser__show_callchain(browser,
1471-
entry, 1, row,
1472-
hist_browser__show_callchain_entry,
1473-
&arg,
1474-
hist_browser__check_output_full);
1314+
printed += hist_browser__show_callchain(browser,
1315+
entry, 1, row,
1316+
hist_browser__show_callchain_entry,
1317+
&arg,
1318+
hist_browser__check_output_full);
14751319
}
14761320

14771321
return printed;

‎tools/perf/ui/stdio/hist.c‎

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -21,64 +21,6 @@ static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
2121
return ret;
2222
}
2323

24-
static size_t inline__fprintf(struct map *map, u64 ip, int left_margin,
25-
int depth, int depth_mask, FILE *fp)
26-
{
27-
struct dso *dso;
28-
struct inline_node *node;
29-
struct inline_list *ilist;
30-
int ret = 0, i;
31-
32-
if (map == NULL)
33-
return 0;
34-
35-
dso = map->dso;
36-
if (dso == NULL)
37-
return 0;
38-
39-
node = dso__parse_addr_inlines(dso,
40-
map__rip_2objdump(map, ip));
41-
if (node == NULL)
42-
return 0;
43-
44-
list_for_each_entry(ilist, &node->val, list) {
45-
if ((ilist->filename != NULL) || (ilist->funcname != NULL)) {
46-
ret += callchain__fprintf_left_margin(fp, left_margin);
47-
48-
for (i = 0; i < depth; i++) {
49-
if (depth_mask & (1 << i))
50-
ret += fprintf(fp, "|");
51-
else
52-
ret += fprintf(fp, " ");
53-
ret += fprintf(fp, " ");
54-
}
55-
56-
if (callchain_param.key == CCKEY_ADDRESS ||
57-
callchain_param.key == CCKEY_SRCLINE) {
58-
if (ilist->filename != NULL)
59-
ret += fprintf(fp, "%s:%d (inline)",
60-
ilist->filename,
61-
ilist->line_nr);
62-
else
63-
ret += fprintf(fp, "??");
64-
} else if (ilist->funcname != NULL)
65-
ret += fprintf(fp, "%s (inline)",
66-
ilist->funcname);
67-
else if (ilist->filename != NULL)
68-
ret += fprintf(fp, "%s:%d (inline)",
69-
ilist->filename,
70-
ilist->line_nr);
71-
else
72-
ret += fprintf(fp, "??");
73-
74-
ret += fprintf(fp, "\n");
75-
}
76-
}
77-
78-
inline_node__delete(node);
79-
return ret;
80-
}
81-
8224
static size_t ipchain__fprintf_graph_line(FILE *fp, int depth, int depth_mask,
8325
int left_margin)
8426
{
@@ -137,9 +79,6 @@ static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_node *node,
13779
fputc('\n', fp);
13880
free(alloc_str);
13981

140-
if (symbol_conf.inline_name)
141-
ret += inline__fprintf(chain->ms.map, chain->ip,
142-
left_margin, depth, depth_mask, fp);
14382
return ret;
14483
}
14584

@@ -314,13 +253,6 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
314253

315254
if (++entries_printed == callchain_param.print_limit)
316255
break;
317-
318-
if (symbol_conf.inline_name)
319-
ret += inline__fprintf(chain->ms.map,
320-
chain->ip,
321-
left_margin,
322-
0, 0,
323-
fp);
324256
}
325257
root = &cnode->rb_root;
326258
}
@@ -600,7 +532,6 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
600532
{
601533
int ret;
602534
int callchain_ret = 0;
603-
int inline_ret = 0;
604535
struct perf_hpp hpp = {
605536
.buf = bf,
606537
.size = size,
@@ -622,13 +553,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
622553
callchain_ret = hist_entry_callchain__fprintf(he, total_period,
623554
0, fp);
624555

625-
if (callchain_ret == 0 && symbol_conf.inline_name) {
626-
inline_ret = inline__fprintf(he->ms.map, he->ip, 0, 0, 0, fp);
627-
ret += inline_ret;
628-
if (inline_ret > 0)
629-
ret += fprintf(fp, "\n");
630-
} else
631-
ret += callchain_ret;
556+
ret += callchain_ret;
632557

633558
return ret;
634559
}

0 commit comments

Comments
 (0)