On Tue, Apr 22, 2014 at 05:49:45PM +0900, Namhyung Kim wrote:

SNIP

>  }
>  
>  static int process_sample_event(struct perf_tool *tool,
> @@ -234,19 +230,17 @@ static int __cmd_annotate(struct perf_annotate *ann)
>       total_nr_samples = 0;
>       evlist__for_each(session->evlist, pos) {
>               struct hists *hists = &pos->hists;
> -             u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
>  
> -             if (nr_samples > 0) {

so this condition of having some data is handled in the
resort I guess.. hm, it will just iterate 0 times ;-)

> -                     total_nr_samples += nr_samples;
> -                     hists__collapse_resort(hists, NULL);
> -                     hists__output_resort(hists);
> +             hists__collapse_resort(hists, NULL);
> +             hists__output_resort(hists);
>  
> -                     if (symbol_conf.event_group &&
> -                         !perf_evsel__is_group_leader(pos))
> -                             continue;
> +             if (symbol_conf.event_group &&
> +                 !perf_evsel__is_group_leader(pos))
> +                     continue;
>  
> -                     hists__find_annotations(hists, pos, ann);
> -             }
> +             hists__find_annotations(hists, pos, ann);
> +
> +             total_nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE];
>       }
>  
>       if (total_nr_samples == 0) {
>  

SNIP

> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index 1c77714f668d..f955ae5a41c5 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -344,9 +344,11 @@ void hists__inc_nr_entries(struct hists *hists, struct 
> hist_entry *h)

I was wondering for a while about the name of this function
since it no longer increments only nr_entries.. but could not
think about any good replacement ;-)

We could also add hists__reset_nr_entries for the zeroing code.


>               hists__calc_col_len(hists, h);

also having hists__calc_col_len called here seems strange

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to