lkml.org 
[lkml]   [2020]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 3/4] perf util: Flexible to set block info output formats
From
Date


On 1/13/2020 6:10 PM, Jiri Olsa wrote:
> 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
>

Yes, that makes sense. I will keep the array.

Thanks
Jin Yao

>
> jirka
>

\
 
 \ /
  Last update: 2020-01-14 01:58    [W:0.069 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site