Re: [PATCH v2 4/7] perf diff: Use hists to manage basic blocks per symbol

From: Jin, Yao
Date: Mon Jun 10 2019 - 22:27:16 EST




On 6/8/2019 7:41 PM, Jin, Yao wrote:


On 6/5/2019 7:44 PM, Jiri Olsa wrote:
On Mon, Jun 03, 2019 at 10:36:14PM +0800, Jin Yao wrote:

SNIP

diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 43623fa..d1641da 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -79,6 +79,9 @@ struct hist_entry_diff {
ÂÂÂÂÂÂÂÂÂ /* HISTC_WEIGHTED_DIFF */
ÂÂÂÂÂÂÂÂÂ s64ÂÂÂ wdiff;
+
+ÂÂÂÂÂÂÂ /* PERF_HPP_DIFF__CYCLES */
+ÂÂÂÂÂÂÂ s64ÂÂÂ cycles;
ÂÂÂÂÂ };
 };
@@ -143,6 +146,9 @@ struct hist_entry {
ÂÂÂÂÂ struct branch_infoÂÂÂ *branch_info;
ÂÂÂÂÂ longÂÂÂÂÂÂÂÂÂÂÂ time;
ÂÂÂÂÂ struct histsÂÂÂÂÂÂÂ *hists;
+ÂÂÂ voidÂÂÂÂÂÂÂÂÂÂÂ *block_hists;
+ÂÂÂ intÂÂÂÂÂÂÂÂÂÂÂ block_idx;
+ÂÂÂ intÂÂÂÂÂÂÂÂÂÂÂ block_num;
ÂÂÂÂÂ struct mem_infoÂÂÂÂÂÂÂ *mem_info;
ÂÂÂÂÂ struct block_infoÂÂÂ *block_info;

could you please not add the new block* stuff in here,
and instead use the "c2c model" and use yourr own struct
on top of hist_entry? we are trying to librarize this
stuff and keep only necessary things in here..

you're already using hist_entry_ops, so should be easy

something like:

ÂÂÂÂstruct block_hist_entry {
ÂÂÂÂÂÂÂ voidÂÂÂÂÂÂÂÂÂÂÂ *block_hists;
ÂÂÂÂÂÂÂ intÂÂÂÂÂÂÂÂÂÂÂ block_idx;
ÂÂÂÂÂÂÂ intÂÂÂÂÂÂÂÂÂÂÂ block_num;
ÂÂÂÂÂÂÂ struct block_infoÂÂÂ *block_info;

ÂÂÂÂÂÂÂ struct hist_entryÂÂÂ he;
ÂÂÂÂ};



jirka


Hi Jiri,

After more considerations, maybe I can't move these stuffs from hist_entry to block_hist_entry.

Actually we use 2 kinds of hist_entry in this patch series. On kind of hist_entry is for symbol/function. The other kind of hist_entry is for basic block.

@@ -143,6 +146,9 @@ struct hist_entry {
ÂÂÂÂÂ struct branch_infoÂÂÂ *branch_info;
ÂÂÂÂÂ longÂÂÂÂÂÂÂÂÂÂÂ time;
ÂÂÂÂÂ struct histsÂÂÂÂÂÂÂ *hists;
+ÂÂÂ voidÂÂÂÂÂÂÂÂÂÂÂ *block_hists;
+ÂÂÂ intÂÂÂÂÂÂÂÂÂÂÂ block_idx;
+ÂÂÂ intÂÂÂÂÂÂÂÂÂÂÂ block_num;
ÂÂÂÂÂ struct mem_infoÂÂÂÂÂÂÂ *mem_info;
ÂÂÂÂÂ struct block_infoÂÂÂ *block_info;

The above hist_entry is actually for symbol/function. This patch series collects all basic blocks in a symbol/function, so it needs a hists in struct hist_entry (block_hists) to point to the hists of basic blocks.

Correct me if I'm wrong.

Thanks
Jin Yao


Hi Jiri,

Either adding a new pointer 'priv' in 'struct map_symbol'?

struct map_symbol {
struct map *map;
struct symbol *sym;
+ void *priv;
};

We create a struct outside and assign the pointer to priv. Logically it should make sense since the symbol/function may have private data for processing.

Any idea?

Thanks
Jin Yao