Re: [PATCH 1/5] perf tools: Count filtered entries to total periodalso

From: Jiri Olsa
Date: Thu Jan 23 2014 - 08:39:26 EST


On Thu, Jan 23, 2014 at 08:28:49AM +0900, Namhyung Kim wrote:
> Currently if a sample was filtered by command line option, it just
> dropped. But this affects final output in that the percentage can be
> different since the filtered entries were not included to the total.
>
> But user might want to see the original percentages when filter
> applied so change the behavior depends on a new symbol_conf.filter_
> relative value in order to be controlled by user later.

SNIP

> + al->filtered |= (1 << HIST_FILTER__SYMBOL);
>
> -out_filtered:
> - al->filtered = true;
> return 0;
> }
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index e4e6249b87d4..73b999448932 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -13,13 +13,6 @@ static bool hists__filter_entry_by_thread(struct hists *hists,
> static bool hists__filter_entry_by_symbol(struct hists *hists,
> struct hist_entry *he);
>
> -enum hist_filter {
> - HIST_FILTER__DSO,
> - HIST_FILTER__THREAD,
> - HIST_FILTER__PARENT,
> - HIST_FILTER__SYMBOL,
> -};

it striked me that al.filtered is duplicating he.filtered, so I thought
we could leave just the one in hist_entry.. now I see annotate, diff
and others use al.filtered to skip hist_entry adding/processing

I think there's use for relative/total switch in other places,
and we could actually get rid of the al.filtered and make
the relative switch global (also in config?) .. in the future ;-)

> -
> struct callchain_param callchain_param = {
> .mode = CHAIN_GRAPH_REL,
> .min_percent = 0.5,
> @@ -329,8 +322,9 @@ void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h)
> if (!h->filtered) {
> hists__calc_col_len(hists, h);
> ++hists->nr_entries;
> - hists->stats.total_period += h->stat.period;
> }
> + if (!h->filtered || !symbol_conf.filter_relative)
> + hists->stats.total_period += h->stat.period;

also we could keep both counts and easily switch on in tui/gui
.. in the future ;-)

jirka
--
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/