perf diff: Print diff result more precisely
Current perf diff result is somewhat confusing since it sometimes hide small result and sometimes there's no result. So do not hide small result (less than 0.01%) and print "N/A" if baseline is not recorded (for ratio and wdiff only). Blank means the baseline is available but its pairs are not. Before: # Baseline Delta Shared Object Symbol # ........ ....... ................. ......................... # ... 0.01% -0.01% [kernel.kallsyms] [k] native_write_msr_safe 0.01% [kernel.kallsyms] [k] scheduler_tick 0.01% [kernel.kallsyms] [k] native_read_msr_safe 0.00% [kernel.kallsyms] [k] __rcu_read_unlock [kernel.kallsyms] [k] _raw_spin_lock +0.01% [kernel.kallsyms] [k] apic_timer_interrupt [kernel.kallsyms] [k] read_tsc After: # Baseline Delta Shared Object Symbol # ........ ....... ................. ......................... # ... 0.01% -0.01% [kernel.kallsyms] [k] native_write_msr_safe 0.01% [kernel.kallsyms] [k] scheduler_tick 0.01% [kernel.kallsyms] [k] native_read_msr_safe 0.00% [kernel.kallsyms] [k] __rcu_read_unlock +0.01% [kernel.kallsyms] [k] _raw_spin_lock +0.01% [kernel.kallsyms] [k] apic_timer_interrupt +0.01% [kernel.kallsyms] [k] read_tsc Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1419656793-32756-3-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Родитель
38259a170d
Коммит
ec3d07cb63
|
@ -788,7 +788,7 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
|
||||||
char pfmt[20] = " ";
|
char pfmt[20] = " ";
|
||||||
|
|
||||||
if (!pair)
|
if (!pair)
|
||||||
goto dummy_print;
|
goto no_print;
|
||||||
|
|
||||||
switch (comparison_method) {
|
switch (comparison_method) {
|
||||||
case COMPUTE_DELTA:
|
case COMPUTE_DELTA:
|
||||||
|
@ -797,8 +797,6 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
|
||||||
else
|
else
|
||||||
diff = compute_delta(he, pair);
|
diff = compute_delta(he, pair);
|
||||||
|
|
||||||
if (fabs(diff) < 0.01)
|
|
||||||
goto dummy_print;
|
|
||||||
scnprintf(pfmt, 20, "%%%+d.2f%%%%", dfmt->header_width - 1);
|
scnprintf(pfmt, 20, "%%%+d.2f%%%%", dfmt->header_width - 1);
|
||||||
return percent_color_snprintf(hpp->buf, hpp->size,
|
return percent_color_snprintf(hpp->buf, hpp->size,
|
||||||
pfmt, diff);
|
pfmt, diff);
|
||||||
|
@ -829,6 +827,9 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
|
||||||
BUG_ON(1);
|
BUG_ON(1);
|
||||||
}
|
}
|
||||||
dummy_print:
|
dummy_print:
|
||||||
|
return scnprintf(hpp->buf, hpp->size, "%*s",
|
||||||
|
dfmt->header_width, "N/A");
|
||||||
|
no_print:
|
||||||
return scnprintf(hpp->buf, hpp->size, "%*s",
|
return scnprintf(hpp->buf, hpp->size, "%*s",
|
||||||
dfmt->header_width, pfmt);
|
dfmt->header_width, pfmt);
|
||||||
}
|
}
|
||||||
|
@ -879,14 +880,15 @@ hpp__entry_pair(struct hist_entry *he, struct hist_entry *pair,
|
||||||
else
|
else
|
||||||
diff = compute_delta(he, pair);
|
diff = compute_delta(he, pair);
|
||||||
|
|
||||||
if (fabs(diff) >= 0.01)
|
scnprintf(buf, size, "%+4.2F%%", diff);
|
||||||
scnprintf(buf, size, "%+4.2F%%", diff);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PERF_HPP_DIFF__RATIO:
|
case PERF_HPP_DIFF__RATIO:
|
||||||
/* No point for ratio number if we are dummy.. */
|
/* No point for ratio number if we are dummy.. */
|
||||||
if (he->dummy)
|
if (he->dummy) {
|
||||||
|
scnprintf(buf, size, "N/A");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (pair->diff.computed)
|
if (pair->diff.computed)
|
||||||
ratio = pair->diff.period_ratio;
|
ratio = pair->diff.period_ratio;
|
||||||
|
@ -899,8 +901,10 @@ hpp__entry_pair(struct hist_entry *he, struct hist_entry *pair,
|
||||||
|
|
||||||
case PERF_HPP_DIFF__WEIGHTED_DIFF:
|
case PERF_HPP_DIFF__WEIGHTED_DIFF:
|
||||||
/* No point for wdiff number if we are dummy.. */
|
/* No point for wdiff number if we are dummy.. */
|
||||||
if (he->dummy)
|
if (he->dummy) {
|
||||||
|
scnprintf(buf, size, "N/A");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (pair->diff.computed)
|
if (pair->diff.computed)
|
||||||
wdiff = pair->diff.wdiff;
|
wdiff = pair->diff.wdiff;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче