[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200113101037.GF35080@krava>
Date: Mon, 13 Jan 2020 11:10:37 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Jin Yao <yao.jin@...ux.intel.com>
Cc: acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
mingo@...hat.com, alexander.shishkin@...ux.intel.com,
Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v3 3/4] perf util: Flexible to set block info output
formats
On Wed, Jan 08, 2020 at 07:03:53AM +0800, Jin Yao wrote:
SNIP
> int report__browse_block_hists(struct block_hist *bh, float min_percent,
> struct evsel *evsel, struct perf_env *env,
> - struct annotation_options *annotation_opts)
> + struct annotation_options *annotation_opts,
> + bool release)
> {
> int ret;
>
> @@ -451,13 +477,17 @@ int report__browse_block_hists(struct block_hist *bh, float min_percent,
> symbol_conf.report_individual_block = true;
> hists__fprintf(&bh->block_hists, true, 0, 0, min_percent,
> stdout, true);
> - hists__delete_entries(&bh->block_hists);
> + if (release)
> + hists__delete_entries(&bh->block_hists);
> +
> return 0;
> case 1:
> symbol_conf.report_individual_block = true;
> ret = block_hists_tui_browse(bh, evsel, min_percent,
> env, annotation_opts);
> - hists__delete_entries(&bh->block_hists);
> + if (release)
> + hists__delete_entries(&bh->block_hists);
> +
> return ret;
> default:
> return -1;
> diff --git a/tools/perf/util/block-info.h b/tools/perf/util/block-info.h
> index bfa22c59195d..0bf01e3a423d 100644
> --- a/tools/perf/util/block-info.h
> +++ b/tools/perf/util/block-info.h
> @@ -44,7 +44,8 @@ enum {
> struct block_report {
> struct block_hist hist;
> u64 cycles;
> - struct block_fmt fmts[PERF_HPP_REPORT__BLOCK_MAX_INDEX];
> + struct block_fmt *fmts;
hum, couldn't you just keep the array and use it instead of allocating it?
it will never be bigger than PERF_HPP_REPORT__BLOCK_MAX_INDEX, no?
we could get rid of that release code
jirka
Powered by blists - more mailing lists