forked from Minki/linux
perf hists: Marking dummy hists entries
It does not make sense to make some computation (ratio, wdiff), when the hist_entry is 'dummy' - added via hists__link. Adding dummy field to struct hist_entry which indicates that it was added by hists__link and avoiding some of the processing for such entries. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-g8bxml0n0pnqsrpyd98p0ird@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
9af303e22a
commit
e0af43d248
@ -187,8 +187,11 @@ static int hpp__color_baseline(struct perf_hpp_fmt *fmt __maybe_unused,
|
|||||||
{
|
{
|
||||||
double percent = baseline_percent(he);
|
double percent = baseline_percent(he);
|
||||||
|
|
||||||
return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%",
|
if (!he->dummy)
|
||||||
percent);
|
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_fmt *_fmt __maybe_unused,
|
static int hpp__entry_baseline(struct perf_hpp_fmt *_fmt __maybe_unused,
|
||||||
@ -197,7 +200,10 @@ static int hpp__entry_baseline(struct perf_hpp_fmt *_fmt __maybe_unused,
|
|||||||
double percent = baseline_percent(he);
|
double percent = baseline_percent(he);
|
||||||
const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
|
const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
|
||||||
|
|
||||||
return scnprintf(hpp->buf, hpp->size, fmt, percent);
|
if (!he->dummy)
|
||||||
|
return scnprintf(hpp->buf, hpp->size, fmt, percent);
|
||||||
|
else
|
||||||
|
return scnprintf(hpp->buf, hpp->size, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hpp__header_period_baseline(struct perf_hpp_fmt *_fmt __maybe_unused,
|
static int hpp__header_period_baseline(struct perf_hpp_fmt *_fmt __maybe_unused,
|
||||||
@ -251,8 +257,7 @@ static int hpp__entry_delta(struct perf_hpp_fmt *_fmt __maybe_unused,
|
|||||||
diff = he->diff.period_ratio_delta;
|
diff = he->diff.period_ratio_delta;
|
||||||
else
|
else
|
||||||
diff = perf_diff__compute_delta(he, pair);
|
diff = perf_diff__compute_delta(he, pair);
|
||||||
} else
|
}
|
||||||
diff = perf_diff__period_percent(he, he->stat.period);
|
|
||||||
|
|
||||||
if (fabs(diff) >= 0.01)
|
if (fabs(diff) >= 0.01)
|
||||||
scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);
|
scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);
|
||||||
@ -282,7 +287,8 @@ static int hpp__entry_ratio(struct perf_hpp_fmt *_fmt __maybe_unused,
|
|||||||
char buf[32] = " ";
|
char buf[32] = " ";
|
||||||
double ratio = 0.0;
|
double ratio = 0.0;
|
||||||
|
|
||||||
if (pair) {
|
/* No point for ratio number if we are dummy.. */
|
||||||
|
if (!he->dummy && pair) {
|
||||||
if (he->diff.computed)
|
if (he->diff.computed)
|
||||||
ratio = he->diff.period_ratio;
|
ratio = he->diff.period_ratio;
|
||||||
else
|
else
|
||||||
@ -317,7 +323,8 @@ static int hpp__entry_wdiff(struct perf_hpp_fmt *_fmt __maybe_unused,
|
|||||||
char buf[32] = " ";
|
char buf[32] = " ";
|
||||||
s64 wdiff = 0;
|
s64 wdiff = 0;
|
||||||
|
|
||||||
if (pair) {
|
/* No point for wdiff number if we are dummy.. */
|
||||||
|
if (!he->dummy && pair) {
|
||||||
if (he->diff.computed)
|
if (he->diff.computed)
|
||||||
wdiff = he->diff.wdiff;
|
wdiff = he->diff.wdiff;
|
||||||
else
|
else
|
||||||
|
@ -912,6 +912,7 @@ static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
|
|||||||
rb_link_node(&he->rb_node_in, parent, p);
|
rb_link_node(&he->rb_node_in, parent, p);
|
||||||
rb_insert_color(&he->rb_node_in, root);
|
rb_insert_color(&he->rb_node_in, root);
|
||||||
hists__inc_nr_entries(hists, he);
|
hists__inc_nr_entries(hists, he);
|
||||||
|
he->dummy = true;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
return he;
|
return he;
|
||||||
|
@ -89,6 +89,9 @@ struct hist_entry {
|
|||||||
|
|
||||||
struct hist_entry_diff diff;
|
struct hist_entry_diff diff;
|
||||||
|
|
||||||
|
/* We are added by hists__add_dummy_entry. */
|
||||||
|
bool dummy;
|
||||||
|
|
||||||
/* XXX These two should move to some tree widget lib */
|
/* XXX These two should move to some tree widget lib */
|
||||||
u16 row_offset;
|
u16 row_offset;
|
||||||
u16 nr_rows;
|
u16 nr_rows;
|
||||||
|
Loading…
Reference in New Issue
Block a user