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] [day] [month] [year] [list]
Message-ID: <tip-7255fe2a42c612f2b8fe4c347f0a5f0c97d85a46@git.kernel.org>
Date:	Sun, 15 Nov 2009 14:30:37 GMT
From:	tip-bot for Lucas De Marchi <lucas.de.marchi@...il.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, acme@...hat.com, hpa@...or.com,
	mingo@...hat.com, a.p.zijlstra@...llo.nl,
	lucas.de.marchi@...il.com, tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/core] perf stat: Do not print ratio when task-clock event is not counted

Commit-ID:  7255fe2a42c612f2b8fe4c347f0a5f0c97d85a46
Gitweb:     http://git.kernel.org/tip/7255fe2a42c612f2b8fe4c347f0a5f0c97d85a46
Author:     Lucas De Marchi <lucas.de.marchi@...il.com>
AuthorDate: Sun, 15 Nov 2009 12:05:08 -0200
Committer:  Ingo Molnar <mingo@...e.hu>
CommitDate: Sun, 15 Nov 2009 15:25:50 +0100

perf stat: Do not print ratio when task-clock event is not counted

The ratio between the number of events and the time elapsed makes
sense only if task-clock event is counted. Otherwise it will be
simply a (confusing)

	#      0.000 M/sec

This patch outputs the ratio only if task-clock event is counted.
Some test examples of before and after:

Before:

 [lucas@...walker linux.trees.git]$ sudo perf stat -e branch-misses -a -- sleep 1

	 Performance counter stats for 'sleep 1':

		1367818  branch-misses            #      0.000 M/sec

	    1.001494325  seconds time elapsed

After (without task-clock):

 [lucas@...walker perf]$ sudo ./perf stat -e branch-misses -a -- sleep 1

	 Performance counter stats for 'sleep 1':

		1135044  branch-misses

	    1.001370775  seconds time elapsed

After (with task-clock):

 [lucas@...walker perf]$ sudo ./perf stat -e branch-misses -e task-clock -a -- sleep 1

	 Performance counter stats for 'sleep 1':

		1070111  branch-misses            #      0.534 M/sec
	    2002.730893  task-clock-msecs         #      1.999 CPUs

	    1.001640292  seconds time elapsed

Signed-off-by: Lucas De Marchi <lucas.de.marchi@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
LKML-Reference: <20091115140507.GB21561@...walker.lan>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
 tools/perf/builtin-stat.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c6df377..c70d720 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -357,7 +357,8 @@ static void abs_printout(int counter, double avg)
 			ratio = avg / total;
 
 		fprintf(stderr, " # %10.3f IPC  ", ratio);
-	} else if (MATCH_EVENT(HARDWARE, HW_BRANCH_MISSES, counter)) {
+	} else if (MATCH_EVENT(HARDWARE, HW_BRANCH_MISSES, counter) &&
+			runtime_branches_stats.n != 0) {
 		total = avg_stats(&runtime_branches_stats);
 
 		if (total)
@@ -365,7 +366,7 @@ static void abs_printout(int counter, double avg)
 
 		fprintf(stderr, " # %10.3f %%    ", ratio);
 
-	} else {
+	} else if (runtime_nsecs_stats.n != 0) {
 		total = avg_stats(&runtime_nsecs_stats);
 
 		if (total)
--
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