linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dsahern@gmail.com, jolsa@kernel.org, mingo@kernel.org,
	peterz@infradead.org, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, namhyung@kernel.org,
	alexander.shishkin@linux.intel.com, acme@redhat.com,
	hpa@zytor.com
Subject: [tip:perf/core] perf stat: Display length strings of each run for --table option
Date: Wed, 2 May 2018 10:42:41 -0700	[thread overview]
Message-ID: <tip-abc60bad0030193ffb55e438664bc09ac53939cf@git.kernel.org> (raw)
In-Reply-To: <20180423090823.32309-9-jolsa@kernel.org>

Commit-ID:  abc60bad0030193ffb55e438664bc09ac53939cf
Gitweb:     https://git.kernel.org/tip/abc60bad0030193ffb55e438664bc09ac53939cf
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 23 Apr 2018 11:08:22 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 26 Apr 2018 09:30:27 -0300

perf stat: Display length strings of each run for --table option

Adding support to display visual aid 'length strings' to easily spot the
biggest difference in time table.

  $ perf stat -r 10 --table perf bench sched pipe
  ...

   Performance counter stats for './perf bench sched pipe' (5 runs):

             # Table of individual measurements:
             5.189 (-0.293) #
             5.189 (-0.294) #
             5.186 (-0.296) #
             5.663 (+0.181) ##
             6.186 (+0.703) ####

             # Final result:
             5.483 +- 0.198 seconds time elapsed  ( +-  3.62% )

Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180423090823.32309-9-jolsa@kernel.org
[ Updated 'perf stat --table' man page entry ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-stat.txt | 12 ++++++------
 tools/perf/builtin-stat.c              |  8 +++++++-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
index 72a2414513bd..3a822f308e6d 100644
--- a/tools/perf/Documentation/perf-stat.txt
+++ b/tools/perf/Documentation/perf-stat.txt
@@ -123,14 +123,14 @@ spreadsheets. Columns are separated by the string specified in SEP.
    Performance counter stats for 'perf bench sched pipe' (5 runs):
 
              # Table of individual measurements:
-             5.379 (-0.176)
-             5.243 (-0.311)
-             5.238 (-0.317)
-             5.536 (-0.019)
-             6.377 (+0.823)
+             5.189 (-0.293) #
+             5.189 (-0.294) #
+             5.186 (-0.296) #
+             5.663 (+0.181) ##
+             6.186 (+0.703) ####
 
              # Final result:
-             5.555 +- 0.213 seconds time elapsed  ( +-  3.83% )
+             5.483 +- 0.198 seconds time elapsed  ( +-  3.62% )
 
 -G name::
 --cgroup name::
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 72553937c010..a4f662a462c6 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1790,9 +1790,15 @@ static void print_table(FILE *output, int precision, double avg)
 
 	for (idx = 0; idx < run_count; idx++) {
 		double run = (double) walltime_run[idx] / NSEC_PER_SEC;
+		int h, n = 1 + abs((int) (100.0 * (run - avg)/run) / 5);
 
-		fprintf(output, " %17.*f (%+.*f)\n",
+		fprintf(output, " %17.*f (%+.*f) ",
 			precision, run, precision, run - avg);
+
+		for (h = 0; h < n; h++)
+			fprintf(output, "#");
+
+		fprintf(output, "\n");
 	}
 
 	fprintf(output, "\n%*s# Final result:\n", indent, "");

  reply	other threads:[~2018-05-02 17:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23  9:08 [PATCH 0/9] perf tools: Assorted fixes Jiri Olsa
2018-04-23  9:08 ` [PATCH 1/9] perf check-headers.sh: Simplify arguments passing Jiri Olsa
2018-05-02 17:40   ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-04-23  9:08 ` [PATCH 2/9] perf check-headers.sh: Add support to check 2 independent files Jiri Olsa
2018-04-23 14:28   ` Arnaldo Carvalho de Melo
2018-05-02 17:41   ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-04-23  9:08 ` [PATCH 3/9] perf stat: Keep the / modifier separator in fallback Jiri Olsa
2018-04-23 14:16   ` Arnaldo Carvalho de Melo
2018-04-26  5:53   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2018-04-23  9:08 ` [PATCH 4/9] perf tools: Fix pmu events parsing rule Jiri Olsa
2018-04-23 14:20   ` Arnaldo Carvalho de Melo
2018-04-23 14:25     ` Jiri Olsa
2018-04-26  5:54   ` [tip:perf/urgent] perf pmu: " tip-bot for Jiri Olsa
2018-04-23  9:08 ` [PATCH 5/9] perf tools: Disable write_backward for leader sampling group events Jiri Olsa
2018-04-23 14:23   ` Arnaldo Carvalho de Melo
2018-04-26  5:54   ` [tip:perf/urgent] perf evsel: " tip-bot for Jiri Olsa
2018-04-23  9:08 ` [PATCH 6/9] perf stat: Display time in precision based on std deviation Jiri Olsa
2018-04-23 14:40   ` Arnaldo Carvalho de Melo
2018-05-02 17:41   ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-04-23  9:08 ` [PATCH 7/9] perf stat: Add --table option to display time of each run Jiri Olsa
2018-04-23 14:41   ` Arnaldo Carvalho de Melo
2018-04-23 15:29     ` Jiri Olsa
2018-05-02 17:42   ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-04-23  9:08 ` [PATCH 8/9] perf stat: Display length strings of each run for --table option Jiri Olsa
2018-05-02 17:42   ` tip-bot for Jiri Olsa [this message]
2018-04-23  9:08 ` [PATCH 9/9] perf stat: Display user and system time Jiri Olsa
2018-04-23 14:51   ` Arnaldo Carvalho de Melo
2018-04-23 15:30     ` Jiri Olsa
2018-04-23 18:48 ` [PATCH 0/9] perf tools: Assorted fixes Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-abc60bad0030193ffb55e438664bc09ac53939cf@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).