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>
bool show_src;
bool use_stdio;
bool stats_only;
bool show_src;
bool use_stdio;
bool stats_only;
/* HITM shared clines stats */
struct c2c_stats hitm_stats;
/* HITM shared clines stats */
struct c2c_stats hitm_stats;
struct c2c_dimension *dim;
};
struct c2c_dimension *dim;
};
+#define SYMBOL_WIDTH 30
+
+static struct c2c_dimension dim_symbol;
+static struct c2c_dimension dim_srcline;
+
+static int symbol_width(struct hists *hists, struct sort_entry *se)
+{
+ int width = hists__col_len(hists, se->se_width_idx);
+
+ if (!c2c.symbol_full)
+ width = MIN(width, SYMBOL_WIDTH);
+
+ return width;
+}
+
static int c2c_width(struct perf_hpp_fmt *fmt,
struct perf_hpp *hpp __maybe_unused,
struct hists *hists __maybe_unused)
static int c2c_width(struct perf_hpp_fmt *fmt,
struct perf_hpp *hpp __maybe_unused,
struct hists *hists __maybe_unused)
c2c_fmt = container_of(fmt, struct c2c_fmt, fmt);
dim = c2c_fmt->dim;
c2c_fmt = container_of(fmt, struct c2c_fmt, fmt);
dim = c2c_fmt->dim;
+ if (dim == &dim_symbol || dim == &dim_srcline)
+ return symbol_width(hists, dim->se);
+
return dim->se ? hists__col_len(hists, dim->se->se_width_idx) :
c2c_fmt->dim->width;
}
return dim->se ? hists__col_len(hists, dim->se->se_width_idx) :
c2c_fmt->dim->width;
}
struct c2c_dimension *dim = c2c_fmt->dim;
size_t len = fmt->user_len;
struct c2c_dimension *dim = c2c_fmt->dim;
size_t len = fmt->user_len;
len = hists__col_len(he->hists, dim->se->se_width_idx);
len = hists__col_len(he->hists, dim->se->se_width_idx);
+ if (dim == &dim_symbol || dim == &dim_srcline)
+ len = symbol_width(he->hists, dim->se);
+ }
+
return dim->se->se_snprintf(he, hpp->buf, hpp->size, len);
}
return dim->se->se_snprintf(he, hpp->buf, hpp->size, len);
}
struct hist_browser *browser;
int key = -1;
struct hist_browser *browser;
int key = -1;
+ /* Display compact version first. */
+ c2c.symbol_full = false;
+
c2c_he = container_of(he, struct c2c_hist_entry, he);
c2c_hists = c2c_he->hists;
c2c_he = container_of(he, struct c2c_hist_entry, he);
c2c_hists = c2c_he->hists;
key = hist_browser__run(browser, "help");
switch (key) {
key = hist_browser__run(browser, "help");
switch (key) {
+ case 's':
+ c2c.symbol_full = !c2c.symbol_full;
+ break;
case 'q':
goto out;
default:
case 'q':
goto out;
default:
#endif
OPT_BOOLEAN(0, "stats", &c2c.stats_only,
"Use the stdio interface"),
#endif
OPT_BOOLEAN(0, "stats", &c2c.stats_only,
"Use the stdio interface"),
+ OPT_BOOLEAN(0, "full-symbols", &c2c.symbol_full,
+ "Display full length of symbols"),
OPT_CALLBACK_DEFAULT('g', "call-graph", &callchain_param,
"print_type,threshold[,print_limit],order,sort_key[,branch],value",
callchain_help, &parse_callchain_opt,
OPT_CALLBACK_DEFAULT('g', "call-graph", &callchain_param,
"print_type,threshold[,print_limit],order,sort_key[,branch],value",
callchain_help, &parse_callchain_opt,