|
@@ -220,7 +220,8 @@ static int setup_compute(const struct option *opt, const char *str,
|
|
|
|
|
|
static double period_percent(struct hist_entry *he, u64 period)
|
|
|
{
|
|
|
- u64 total = he->hists->stats.total_period;
|
|
|
+ u64 total = hists__total_period(he->hists);
|
|
|
+
|
|
|
return (period * 100.0) / total;
|
|
|
}
|
|
|
|
|
@@ -259,11 +260,18 @@ static s64 compute_wdiff(struct hist_entry *he, struct hist_entry *pair)
|
|
|
static int formula_delta(struct hist_entry *he, struct hist_entry *pair,
|
|
|
char *buf, size_t size)
|
|
|
{
|
|
|
+ u64 he_total = he->hists->stats.total_period;
|
|
|
+ u64 pair_total = pair->hists->stats.total_period;
|
|
|
+
|
|
|
+ if (symbol_conf.filter_relative) {
|
|
|
+ he_total = he->hists->stats.total_non_filtered_period;
|
|
|
+ pair_total = pair->hists->stats.total_non_filtered_period;
|
|
|
+ }
|
|
|
return scnprintf(buf, size,
|
|
|
"(%" PRIu64 " * 100 / %" PRIu64 ") - "
|
|
|
"(%" PRIu64 " * 100 / %" PRIu64 ")",
|
|
|
- pair->stat.period, pair->hists->stats.total_period,
|
|
|
- he->stat.period, he->hists->stats.total_period);
|
|
|
+ pair->stat.period, pair_total,
|
|
|
+ he->stat.period, he_total);
|
|
|
}
|
|
|
|
|
|
static int formula_ratio(struct hist_entry *he, struct hist_entry *pair,
|
|
@@ -327,15 +335,16 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- if (al.filtered)
|
|
|
- return 0;
|
|
|
-
|
|
|
if (hists__add_entry(&evsel->hists, &al, sample->period,
|
|
|
sample->weight, sample->transaction)) {
|
|
|
pr_warning("problem incrementing symbol period, skipping event\n");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
+ if (al.filtered == 0) {
|
|
|
+ evsel->hists.stats.total_non_filtered_period += sample->period;
|
|
|
+ evsel->hists.nr_non_filtered_entries++;
|
|
|
+ }
|
|
|
evsel->hists.stats.total_period += sample->period;
|
|
|
return 0;
|
|
|
}
|
|
@@ -565,7 +574,9 @@ static void hists__compute_resort(struct hists *hists)
|
|
|
next = rb_first(root);
|
|
|
|
|
|
hists->nr_entries = 0;
|
|
|
+ hists->nr_non_filtered_entries = 0;
|
|
|
hists->stats.total_period = 0;
|
|
|
+ hists->stats.total_non_filtered_period = 0;
|
|
|
hists__reset_col_len(hists);
|
|
|
|
|
|
while (next != NULL) {
|
|
@@ -732,13 +743,16 @@ static const struct option options[] = {
|
|
|
OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
|
|
|
"Look for files with symbols relative to this directory"),
|
|
|
OPT_UINTEGER('o', "order", &sort_compute, "Specify compute sorting."),
|
|
|
+ OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
|
|
|
+ "How to display percentage of filtered entries", parse_filter_percentage),
|
|
|
OPT_END()
|
|
|
};
|
|
|
|
|
|
static double baseline_percent(struct hist_entry *he)
|
|
|
{
|
|
|
- struct hists *hists = he->hists;
|
|
|
- return 100.0 * he->stat.period / hists->stats.total_period;
|
|
|
+ u64 total = hists__total_period(he->hists);
|
|
|
+
|
|
|
+ return 100.0 * he->stat.period / total;
|
|
|
}
|
|
|
|
|
|
static int hpp__color_baseline(struct perf_hpp_fmt *fmt,
|