From: tip-bot for Namhyung Kim <namhyung.kim@lge.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
hpa@zytor.com, mingo@redhat.com, a.p.zijlstra@chello.nl,
namhyung.kim@lge.com, namhyung@gmail.com, tglx@linutronix.de,
mingo@elte.hu
Subject: [tip:perf/core] perf stat: Adjust print unit
Date: Tue, 7 Feb 2012 11:38:36 -0800 [thread overview]
Message-ID: <tip-5fde2523bddb71d96f12b6ee8d2a9a43cb99da96@git.kernel.org> (raw)
In-Reply-To: <1328514285-26232-1-git-send-email-namhyung.kim@lge.com>
Commit-ID: 5fde2523bddb71d96f12b6ee8d2a9a43cb99da96
Gitweb: http://git.kernel.org/tip/5fde2523bddb71d96f12b6ee8d2a9a43cb99da96
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Mon, 6 Feb 2012 16:44:44 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 6 Feb 2012 19:17:11 -0200
perf stat: Adjust print unit
The default 'M/sec' unit is not useful if the result is small enough.
Adjust it dynamically according to the value.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1328514285-26232-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-stat.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 459b862..32d930e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -844,12 +844,18 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)
fprintf(output, " # %8.3f GHz ", ratio);
} else if (runtime_nsecs_stats[cpu].n != 0) {
+ char unit = 'M';
+
total = avg_stats(&runtime_nsecs_stats[cpu]);
if (total)
ratio = 1000.0 * avg / total;
+ if (ratio < 0.001) {
+ ratio *= 1000;
+ unit = 'K';
+ }
- fprintf(output, " # %8.3f M/sec ", ratio);
+ fprintf(output, " # %8.3f %c/sec ", ratio, unit);
} else {
fprintf(output, " ");
}
prev parent reply other threads:[~2012-02-07 19:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 7:44 [PATCH 1/2] " Namhyung Kim
2012-02-06 7:44 ` [PATCH 2/2] perf stat: Align scaled output of cpu-clock Namhyung Kim
2012-02-07 19:39 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-02-07 19:38 ` tip-bot for Namhyung Kim [this message]
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-5fde2523bddb71d96f12b6ee8d2a9a43cb99da96@git.kernel.org \
--to=namhyung.kim@lge.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=namhyung@gmail.com \
--cc=paulus@samba.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
Powered by JetHome