Re: [PATCH v2 3/5] perf report: Sort by sampled cycles percent per block for stdio

From: Jiri Olsa
Date: Mon Oct 21 2019 - 12:08:14 EST


On Tue, Oct 15, 2019 at 01:33:48PM +0800, Jin Yao wrote:

SNIP

> + cycles += bi->cycles_aggr / bi->num_aggr;
> +
> + he_block = hists__add_entry_block(&bh->block_hists,
> + &al, bi);
> + if (!he_block) {
> + block_info__put(bi);
> + return -1;
> + }
> + }
> + }
> +
> + if (block_cycles)
> + *block_cycles += cycles;
> +
> + return 0;
> +}
> +
> +static int resort_cb(struct hist_entry *he, void *arg __maybe_unused)
> +{
> + /* Skip the calculation of column length in output_resort */
> + he->filtered = true;

that's a nasty hack ;-) together with setting it back to false just below

why do you want to skip the columns calculation? we could add those columns
to the output as well no?

jirka

> + return 0;
> +}
> +
> +static void hists__clear_filtered(struct hists *hists)
> +{
> + struct rb_node *next = rb_first_cached(&hists->entries);
> + struct hist_entry *he;
> +
> + while (next) {
> + he = rb_entry(next, struct hist_entry, rb_node);
> + he->filtered = false;
> + next = rb_next(&he->rb_node);
> + }
> +}

SNIP

jirka