Re: [PATCH v3 2/7] perf util: Create streams for managing top N hottest callchains

From: Jin, Yao
Date: Tue Apr 28 2020 - 04:12:15 EST


Hi Jiri,

On 4/27/2020 6:10 PM, Jiri Olsa wrote:
On Mon, Apr 20, 2020 at 09:04:46AM +0800, Jin Yao wrote:
We think the stream is a callchain which is aggregated by the LBR
records from samples. By browsing the stream, we can understand
the code flow.

The struct callchain_node represents one callchain and we use the
callchain_node->hit to measure the hot level of this callchain.
Higher is hotter.

Since in perf data file, there may be many callchains so we just
need to focus on the top N hottest callchains. N is a user defined
parameter or just a predefined default value.

This patch saves the top N hottest callchains in 'struct stream_node'
type array, which is defined in a per event 'struct callchain_streams'.

So now we can get the per-event top N hottest callchains.

v2:
---
Use zfree in free_evsel_streams().

Signed-off-by: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
---
tools/perf/util/callchain.c | 122 ++++++++++++++++++++++++++++++++++++
tools/perf/util/callchain.h | 16 +++++
2 files changed, 138 insertions(+)

SNIP

could this and all the other related code moved to separated object
like streams.c or such.. I think also the stuff from patch 1 could
go there, as it's specific only to this streams code

jirka


That's fine. I will move the related codes to a new streams.c/streams.h.

Thanks
Jin Yao