提交 53dd9b5f 编写于 作者: P Peter Zijlstra (Intel) 提交者: Arnaldo Carvalho de Melo

perf annotate: Simplify header dotted line sizing

No need to use strlen, etc to figure that out, just use the return from
printf(), it will tell how wide the following line needs to be.
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20160630082955.GA30921@twins.programming.kicks-ass.net
[ split from a larger patch ]
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 f4e47f9f
......@@ -1528,7 +1528,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
int more = 0;
u64 len;
int width = 8;
int namelen, evsel_name_len, graph_dotted_len;
int graph_dotted_len;
filename = strdup(dso->long_name);
if (!filename)
......@@ -1540,17 +1540,14 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
d_filename = basename(filename);
len = symbol__size(sym);
namelen = strlen(d_filename);
evsel_name_len = strlen(evsel_name);
if (perf_evsel__is_group_event(evsel))
width *= evsel->nr_members;
printf(" %-*.*s| Source code & Disassembly of %s for %s\n",
graph_dotted_len = printf(" %-*.*s| Source code & Disassembly of %s for %s\n",
width, width, "Percent", d_filename, evsel_name);
graph_dotted_len = width + namelen + evsel_name_len;
printf("-%-*.*s-----------------------------------------\n",
printf("%-*.*s----\n",
graph_dotted_len, graph_dotted_len, graph_dotted_line);
if (verbose)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册