lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1476975876-2522-48-git-send-email-acme@kernel.org>
Date:   Thu, 20 Oct 2016 12:04:31 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     linux-kernel@...r.kernel.org, Linux Weekly News <lwn@....net>,
        Jiri Olsa <jolsa@...nel.org>, Andi Kleen <andi@...stfloor.org>,
        David Ahern <dsahern@...il.com>,
        Don Zickus <dzickus@...hat.com>, Joe Mario <jmario@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 47/52] perf c2c report: Add support to manage symbol name length

From: Jiri Olsa <jolsa@...nel.org>

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@...nel.org>
Cc: Andi Kleen <andi@...stfloor.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Don Zickus <dzickus@...hat.com>
Cc: Joe Mario <jmario@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/n/tip-yxf5hfteyfaoi8xrgczqtyha@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-c2c.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 430360e618b0..00d1620dc2bf 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -62,6 +62,7 @@ struct perf_c2c {
 	bool			 show_src;
 	bool			 use_stdio;
 	bool			 stats_only;
+	bool			 symbol_full;
 
 	/* HITM shared clines stats */
 	struct c2c_stats	hitm_stats;
@@ -336,6 +337,21 @@ struct c2c_fmt {
 	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)
@@ -346,6 +362,9 @@ static int c2c_width(struct perf_hpp_fmt *fmt,
 	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;
 }
@@ -1563,9 +1582,13 @@ static int c2c_se_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 	struct c2c_dimension *dim = c2c_fmt->dim;
 	size_t len = fmt->user_len;
 
-	if (!len)
+	if (!len) {
 		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);
 }
 
@@ -2159,6 +2182,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
 	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;
 
@@ -2178,6 +2204,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
 		key = hist_browser__run(browser, "help");
 
 		switch (key) {
+		case 's':
+			c2c.symbol_full = !c2c.symbol_full;
+			break;
 		case 'q':
 			goto out;
 		default:
@@ -2449,6 +2478,8 @@ static int perf_c2c__report(int argc, const char **argv)
 #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,
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ