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]
Date:	Sat, 20 Oct 2012 16:33:18 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Jiri Olsa <jolsa@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Namhyung Kim <namhyung@...nel.org>
Subject: [PATCH 10/11] perf tool: Display period values for all group members

When in report group mode (perf report --group) with option
--show-total-period, display period values for all group members.

Currently only the group leader period counts are shown.

Example of new output:

  $ perf report --group --show-total-period --stdio
  ...

  # Samples: 76  of event 'anon group { cycles, cache-misses }'
  # Event count (approx.): 32249096
  #
  #         Overhead                    Period  Command      Shared Object                         Symbol
  # ................  ........................  .......  .................  .............................
  #
      18.45%  11.67%       5949678         333       ls  [kernel.kallsyms]  [k] __lock_acquire
      16.49%  11.39%       5317432         325       ls  [kernel.kallsyms]  [k] native_sched_clock
       8.55%  15.42%       2757064         440       ls  [kernel.kallsyms]  [k] lock_acquire
       8.31%  12.58%       2680708         359       ls  [kernel.kallsyms]  [k] clear_page_c

  ...

Signed-off-by: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
---
 tools/perf/ui/hist.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 51934a8..50e8d85 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -273,21 +273,59 @@ static int hpp__entry_samples(struct perf_hpp *hpp, struct hist_entry *he)
 
 static int hpp__header_period(struct perf_hpp *hpp)
 {
-	const char *fmt = symbol_conf.field_sep ? "%s" : "%12s";
+	int len = 12;
+
+	if (symbol_conf.field_sep)
+		return scnprintf(hpp->buf, hpp->size, "%s", "Period");
+
+	if (symbol_conf.event_group) {
+		struct perf_evsel *evsel = hpp->ptr;
+
+		BUG_ON(!perf_evsel__is_group_leader(evsel));
+
+		len += evsel->nr_members * 12;
+	}
 
-	return scnprintf(hpp->buf, hpp->size, fmt, "Period");
+	return scnprintf(hpp->buf, hpp->size, "%*s", len, "Period");
 }
 
 static int hpp__width_period(struct perf_hpp *hpp __maybe_unused)
 {
-	return 12;
+	int len = 12;
+
+	if (symbol_conf.event_group) {
+		struct perf_evsel *evsel = hpp->ptr;
+
+		len += evsel->nr_members * 12;
+	}
+
+	return len;
 }
 
 static int hpp__entry_period(struct perf_hpp *hpp, struct hist_entry *he)
 {
 	const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64;
+	struct hists *hists = he->hists;
+	int ret;
+
+	ret = scnprintf(hpp->buf, hpp->size, fmt, he->stat.period);
+
+	if (symbol_conf.event_group) {
+		int i;
+		struct perf_evsel *evsel = hists_2_evsel(hists);
+
+		for (i = 0; i < evsel->nr_members; i++) {
+			u64 period = he->group_stats[i].period;
 
-	return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period);
+			if (symbol_conf.field_sep) {
+				ret += scnprintf(hpp->buf + ret,
+						 hpp->size - ret, " ");
+			}
+			ret += scnprintf(hpp->buf + ret, hpp->size - ret,
+					 fmt, period);
+		}
+	}
+	return ret;
 }
 
 static int hpp__header_period_baseline(struct perf_hpp *hpp)
-- 
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ