aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-07-10 10:25:15 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-21 09:31:59 -0400
commit590b6a3ac5133e3fff9ac6f44af0dc0f3eb7c397 (patch)
tree5d2124a3d580b998791e13037bb7f1c009bce25b
parentbb342daed8903af7fa984a1e227f4a44f1b36b88 (diff)
perf c2c report: Add support to manage symbol name length
The width of symbol and source line entries could get really long and not convenient to display. Adding support to display only patrt of such strings and possibility to switch to full length by uing --full-symbols option or 's' key in TUI browser. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Joe Mario <jmario@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-yxf5hfteyfaoi8xrgczqtyha@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-c2c.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index b3e48e42e825..4645461bd997 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -62,6 +62,7 @@ struct perf_c2c {
62 bool show_src; 62 bool show_src;
63 bool use_stdio; 63 bool use_stdio;
64 bool stats_only; 64 bool stats_only;
65 bool symbol_full;
65 66
66 /* HITM shared clines stats */ 67 /* HITM shared clines stats */
67 struct c2c_stats hitm_stats; 68 struct c2c_stats hitm_stats;
@@ -336,6 +337,21 @@ struct c2c_fmt {
336 struct c2c_dimension *dim; 337 struct c2c_dimension *dim;
337}; 338};
338 339
340#define SYMBOL_WIDTH 30
341
342static struct c2c_dimension dim_symbol;
343static struct c2c_dimension dim_srcline;
344
345static int symbol_width(struct hists *hists, struct sort_entry *se)
346{
347 int width = hists__col_len(hists, se->se_width_idx);
348
349 if (!c2c.symbol_full)
350 width = MIN(width, SYMBOL_WIDTH);
351
352 return width;
353}
354
339static int c2c_width(struct perf_hpp_fmt *fmt, 355static int c2c_width(struct perf_hpp_fmt *fmt,
340 struct perf_hpp *hpp __maybe_unused, 356 struct perf_hpp *hpp __maybe_unused,
341 struct hists *hists __maybe_unused) 357 struct hists *hists __maybe_unused)
@@ -346,6 +362,9 @@ static int c2c_width(struct perf_hpp_fmt *fmt,
346 c2c_fmt = container_of(fmt, struct c2c_fmt, fmt); 362 c2c_fmt = container_of(fmt, struct c2c_fmt, fmt);
347 dim = c2c_fmt->dim; 363 dim = c2c_fmt->dim;
348 364
365 if (dim == &dim_symbol || dim == &dim_srcline)
366 return symbol_width(hists, dim->se);
367
349 return dim->se ? hists__col_len(hists, dim->se->se_width_idx) : 368 return dim->se ? hists__col_len(hists, dim->se->se_width_idx) :
350 c2c_fmt->dim->width; 369 c2c_fmt->dim->width;
351} 370}
@@ -1563,9 +1582,13 @@ static int c2c_se_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
1563 struct c2c_dimension *dim = c2c_fmt->dim; 1582 struct c2c_dimension *dim = c2c_fmt->dim;
1564 size_t len = fmt->user_len; 1583 size_t len = fmt->user_len;
1565 1584
1566 if (!len) 1585 if (!len) {
1567 len = hists__col_len(he->hists, dim->se->se_width_idx); 1586 len = hists__col_len(he->hists, dim->se->se_width_idx);
1568 1587
1588 if (dim == &dim_symbol || dim == &dim_srcline)
1589 len = symbol_width(he->hists, dim->se);
1590 }
1591
1569 return dim->se->se_snprintf(he, hpp->buf, hpp->size, len); 1592 return dim->se->se_snprintf(he, hpp->buf, hpp->size, len);
1570} 1593}
1571 1594
@@ -2159,6 +2182,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
2159 struct hist_browser *browser; 2182 struct hist_browser *browser;
2160 int key = -1; 2183 int key = -1;
2161 2184
2185 /* Display compact version first. */
2186 c2c.symbol_full = false;
2187
2162 c2c_he = container_of(he, struct c2c_hist_entry, he); 2188 c2c_he = container_of(he, struct c2c_hist_entry, he);
2163 c2c_hists = c2c_he->hists; 2189 c2c_hists = c2c_he->hists;
2164 2190
@@ -2178,6 +2204,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
2178 key = hist_browser__run(browser, "help"); 2204 key = hist_browser__run(browser, "help");
2179 2205
2180 switch (key) { 2206 switch (key) {
2207 case 's':
2208 c2c.symbol_full = !c2c.symbol_full;
2209 break;
2181 case 'q': 2210 case 'q':
2182 goto out; 2211 goto out;
2183 default: 2212 default:
@@ -2449,6 +2478,8 @@ static int perf_c2c__report(int argc, const char **argv)
2449#endif 2478#endif
2450 OPT_BOOLEAN(0, "stats", &c2c.stats_only, 2479 OPT_BOOLEAN(0, "stats", &c2c.stats_only,
2451 "Use the stdio interface"), 2480 "Use the stdio interface"),
2481 OPT_BOOLEAN(0, "full-symbols", &c2c.symbol_full,
2482 "Display full length of symbols"),
2452 OPT_CALLBACK_DEFAULT('g', "call-graph", &callchain_param, 2483 OPT_CALLBACK_DEFAULT('g', "call-graph", &callchain_param,
2453 "print_type,threshold[,print_limit],order,sort_key[,branch],value", 2484 "print_type,threshold[,print_limit],order,sort_key[,branch],value",
2454 callchain_help, &parse_callchain_opt, 2485 callchain_help, &parse_callchain_opt,