Re: [PATCH v4 3/4] perf util: Flexible to set block info output formats

From: Jin, Yao
Date: Mon Jan 20 2020 - 09:50:49 EST




On 1/20/2020 5:47 PM, Jiri Olsa wrote:
On Thu, Jan 16, 2020 at 03:29:03AM +0800, Jin Yao wrote:

SNIP

}
+void block_info__free_report(struct block_report *reps, int nr_reps)
+{
+ for (int i = 0; i < nr_reps; i++)
+ hists__delete_entries(&reps[i].hist.block_hists);
+
+ free(reps);
+}
+
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 +473,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;

I don't understand this change.. why do you relase it in here?
there's release call in block_info__free_report you just added...

jirka


Yes, I have released the hists entries in block_info__free_report(). I don't need to keep the release code here. Thanks so much for pointing this out.

Thanks
Jin Yao