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

From: Jiri Olsa
Date: Wed Oct 23 2019 - 07:36:48 EST


On Tue, Oct 22, 2019 at 04:07:08PM +0800, Jin Yao wrote:

SNIP

> +static void get_block_hists(struct hists *hists, struct block_hist *bh,
> + struct report *rep)
> +{
> + struct rb_node *next = rb_first_cached(&hists->entries);
> + struct hist_entry *he;
> +
> + init_block_hist(bh, rep);
> +
> + while (next) {
> + he = rb_entry(next, struct hist_entry, rb_node);
> + block_info__process_sym(he, bh, &rep->block_cycles,
> + rep->cycles_count);
> + next = rb_next(&he->rb_node);
> + }
> +
> + hists__output_resort(&bh->block_hists, NULL);
> +}
> +
> +static int hists__fprintf_all_blocks(struct hists *hists, struct report *rep)
> +{
> + struct block_hist *bh = &rep->block_hist;
> +
> + get_block_hists(hists, bh, rep);
> + symbol_conf.report_individual_block = true;
> + hists__fprintf(&bh->block_hists, true, 0, 0, 0,
> + stdout, true);
> + hists__delete_entries(&bh->block_hists);
> + return 0;
> +}
> +
> static int perf_evlist__tty_browse_hists(struct evlist *evlist,
> struct report *rep,
> const char *help)
> @@ -500,6 +820,12 @@ static int perf_evlist__tty_browse_hists(struct evlist *evlist,
> continue;
>
> hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
> +
> + if (rep->total_cycles) {
> + hists__fprintf_all_blocks(hists, rep);

it's still being computed in output function, the computation
should be outside.. like in report__output_resort or such

thanks,
jirka