Re: [PATCH v3] perf annotate/report: Remove hist__account_cycles from callback

From: Arnaldo Carvalho de Melo
Date: Wed Apr 10 2019 - 09:00:17 EST


Em Sat, Mar 16, 2019 at 05:16:17AM +0800, Jin Yao escreveu:
> The hist__account_cycles is executed when the hist_iter__branch_callback
> is called. But it looks it's not necessary. In hist__account_cycles, it
> already walks on all branch entries.
>
> This patch moves the hist__account_cycles out of callback, now the data
> processing is much faster than before.
>
> Previous code has an issue that the ch[offset].num++
> (in __symbol__account_cycles) is executed repeatedly since
> hist__account_cycles is called in each hist_iter__branch_callback,
> so the counting of ch[offset].num is not correct (too big).
> With this patch, the issue is fixed. And we don't need the code of
> "ch->reset >= ch->num / 2" to check if there are too many overlaps
> (in annotation__count_and_fill), otherwise some data would be
> hidden.
>
> Now, we can try, for example:

Tested with:

perf annotate --stdio
perf annotate --stdio2
perf annotate --tui
perf report --tui -> press annotation hotkey 'a'

Applied,

- Arnaldo