perf diff: Display empty space for non paired samples
authorJiri Olsa <[email protected]>
Fri, 5 Oct 2012 14:44:47 +0000 (16:44 +0200)
committerArnaldo Carvalho de Melo <[email protected]>
Fri, 5 Oct 2012 17:15:19 +0000 (14:15 -0300)
Currently in 'Baseline' and 'Period Base' columns zero values are
displayed in case no pair is found for the sample. This might be
confusing, using empty space instead.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/ui/hist.c

index 305eb79f4af4153728524ae1b898c98b5f35b1c3..4f5f4756faacdb6e5d1638d4b876655b2116823f 100644 (file)
@@ -179,7 +179,10 @@ static int hpp__color_baseline(struct perf_hpp *hpp, struct hist_entry *he)
 {
        double percent = baseline_percent(he);
 
-       return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent);
+       if (he->pair)
+               return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent);
+       else
+               return scnprintf(hpp->buf, hpp->size, "        ");
 }
 
 static int hpp__entry_baseline(struct perf_hpp *hpp, struct hist_entry *he)
@@ -187,7 +190,10 @@ static int hpp__entry_baseline(struct perf_hpp *hpp, struct hist_entry *he)
        double percent = baseline_percent(he);
        const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
 
-       return scnprintf(hpp->buf, hpp->size, fmt, percent);
+       if (he->pair || symbol_conf.field_sep)
+               return scnprintf(hpp->buf, hpp->size, fmt, percent);
+       else
+               return scnprintf(hpp->buf, hpp->size, "            ");
 }
 
 static int hpp__header_samples(struct perf_hpp *hpp)