[PATCH 1/3 -tip] perf stat: fix stat output

From: Jaswinder Singh Rajput
Date: Fri Jun 26 2009 - 17:42:52 EST



Increase size for event name to handle big names like 'L1-d$-prefetch-misses'

Changed scaled as a multiplicative factor is more expressive,
than the percentage of from where we scale up.

Also aligned scaled otherwise sometimes it looks like :

384 iTLB-load-misses (4.74x scaled)
452029 branch-loads (8.00x scaled)
5892 branch-load-misses (20.39x scaled)
972315 iTLB-loads (3.24x scaled)

Before :
150708 L1-d$-stores (scaled from 23.57%)
428804 L1-d$-prefetches (scaled from 23.47%)
314446 L1-d$-prefetch-misses (scaled from 23.42%)
252626137 L1-i$-loads (scaled from 23.24%)
5297550 dTLB-load-misses (scaled from 23.96%)
106992392 branch-loads (scaled from 23.67%)
5239561 branch-load-misses (scaled from 23.43%)

After :

1731713 L1-d$-loads ( 14.25x scaled)
44241 L1-d$-prefetches ( 3.88x scaled)
21076 L1-d$-prefetch-misses ( 3.40x scaled)
5789421 L1-i$-loads ( 3.78x scaled)
29645 dTLB-load-misses ( 2.95x scaled)
461474 branch-loads ( 6.52x scaled)
7493 branch-load-misses ( 26.57x scaled)

Reported-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@xxxxxxxxx>
---
tools/perf/builtin-stat.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8420ec5..9ff9dd5 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -32,6 +32,7 @@
* Wu Fengguang <fengguang.wu@xxxxxxxxx>
* Mike Galbraith <efault@xxxxxx>
* Paul Mackerras <paulus@xxxxxxxxx>
+ * Jaswinder Singh Rajput <jaswinder@xxxxxxxxxx>
*
* Released under the GPL v2. (and only v2, not any later version)
*/
@@ -250,7 +251,7 @@ static void nsec_printout(int counter, u64 *count, u64 *noise)
{
double msecs = (double)count[0] / 1000000;

- fprintf(stderr, " %14.6f %-20s", msecs, event_name(counter));
+ fprintf(stderr, " %14.6f %-24s", msecs, event_name(counter));

if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
@@ -264,7 +265,7 @@ static void nsec_printout(int counter, u64 *count, u64 *noise)

static void abs_printout(int counter, u64 *count, u64 *noise)
{
- fprintf(stderr, " %14Ld %-20s", count[0], event_name(counter));
+ fprintf(stderr, " %14Ld %-24s", count[0], event_name(counter));

if (runtime_cycles_avg &&
attrs[counter].type == PERF_TYPE_HARDWARE &&
@@ -294,7 +295,7 @@ static void print_counter(int counter)
scaled = event_scaled_avg[counter];

if (scaled == -1) {
- fprintf(stderr, " %14s %-20s\n",
+ fprintf(stderr, " %14s %-24s\n",
"<not counted>", event_name(counter));
return;
}
@@ -305,8 +306,7 @@ static void print_counter(int counter)
abs_printout(counter, count, noise);

if (scaled)
- fprintf(stderr, " (scaled from %.2f%%)",
- (double) count[2] / count[1] * 100);
+ fprintf(stderr, " (%7.2fx scaled)", (double)count[1]/count[2]);

fprintf(stderr, "\n");
}
@@ -417,7 +417,6 @@ static void print_stat(int argc, const char **argv)
for (counter = 0; counter < nr_counters; counter++)
print_counter(counter);

-
fprintf(stderr, "\n");
fprintf(stderr, " %14.9f seconds time elapsed.\n",
(double)walltime_nsecs_avg/1e9);
--
1.6.0.6



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