[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200313071118.11983-14-yao.jin@linux.intel.com>
Date: Fri, 13 Mar 2020 15:11:17 +0800
From: Jin Yao <yao.jin@...ux.intel.com>
To: acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
mingo@...hat.com, alexander.shishkin@...ux.intel.com
Cc: Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
kan.liang@...el.com, yao.jin@...el.com,
Jin Yao <yao.jin@...ux.intel.com>
Subject: [PATCH v2 13/14] perf util: Filter out blocks by name of changed functions
Similar as previous patch "perf util: Filter out streams
by name of changed functions", user provides a list of changed
functions, then perf-diff can know these functions are not
matched between old perf data and new perf data.
In this patch, the names of changed function names have been
stored in strlist, and we will check if the symbol name is in
strlist. If yes, that means this function is changed and the
related blocks are not matched.
Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
---
tools/perf/builtin-diff.c | 4 ++--
tools/perf/util/block-info.c | 18 ++++++++++++------
tools/perf/util/block-info.h | 4 +++-
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 2f891e8a5122..98e9ab8c69ce 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -703,7 +703,7 @@ static void hists__precompute(struct hists *hists)
if (bh->valid && pair_bh->valid) {
block_hists_match(&bh->block_hists,
&pair_bh->block_hists,
- NULL,
+ NULL, NULL,
compute_cycles_diff);
hists__output_resort(&pair_bh->block_hists,
NULL);
@@ -1043,7 +1043,7 @@ static int process_base_stream(struct data__file *data_base,
block_hists_addr2line(&rep_pair->hist.block_hists, pair_dir);
block_info__match_report(rep_base, rep_pair,
- pdiff.src_list, NULL);
+ pdiff.src_list, NULL, NULL);
fprintf(stdout, "%s", title);
diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c
index 4d0275fbd0df..255b54ce2962 100644
--- a/tools/perf/util/block-info.c
+++ b/tools/perf/util/block-info.c
@@ -93,7 +93,7 @@ struct block_info *block_info__new(void)
}
int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right,
- struct srclist *src_list)
+ struct srclist *src_list, struct strlist *func_list)
{
struct block_info *bi_l = left->block_info;
struct block_info *bi_r = right->block_info;
@@ -113,6 +113,9 @@ int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right,
if (cmp)
return cmp;
+ if (func_list && strlist__has_entry(func_list, bi_l->sym->name))
+ return -1;
+
if (src_list && bi_l->line && bi_r->line) {
if (block_same_srcfiles(bi_l->line, bi_r->line) &&
bi_l->line->start_rel) {
@@ -143,7 +146,7 @@ int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right,
int64_t block_info__cmp(struct perf_hpp_fmt *fmt __maybe_unused,
struct hist_entry *left, struct hist_entry *right)
{
- return __block_info__cmp(left, right, NULL);
+ return __block_info__cmp(left, right, NULL, NULL);
}
static void init_block_info(struct block_info *bi, struct symbol *sym,
@@ -855,7 +858,8 @@ bool block_srclist_matched(struct srclist *slist, char *rel_path,
static struct hist_entry *get_block_pair(struct hist_entry *he,
struct hists *hists_pair,
- struct srclist *src_list)
+ struct srclist *src_list,
+ struct strlist *func_list)
{
struct rb_root_cached *root = hists_pair->entries_in;
struct rb_node *next = rb_first_cached(root);
@@ -867,7 +871,7 @@ static struct hist_entry *get_block_pair(struct hist_entry *he,
next = rb_next(&he_pair->rb_node_in);
- cmp = __block_info__cmp(he_pair, he, src_list);
+ cmp = __block_info__cmp(he_pair, he, src_list, func_list);
if (!cmp)
return he_pair;
}
@@ -878,6 +882,7 @@ static struct hist_entry *get_block_pair(struct hist_entry *he,
void block_hists_match(struct hists *hists_base,
struct hists *hists_pair,
struct srclist *src_list,
+ struct strlist *func_list,
void (*func)(struct hist_entry *,
struct hist_entry *))
{
@@ -888,7 +893,7 @@ void block_hists_match(struct hists *hists_base,
struct hist_entry *he = rb_entry(next, struct hist_entry,
rb_node_in);
struct hist_entry *pair = get_block_pair(he, hists_pair,
- src_list);
+ src_list, func_list);
next = rb_next(&he->rb_node_in);
@@ -904,6 +909,7 @@ void block_hists_match(struct hists *hists_base,
int block_info__match_report(struct block_report *rep_base,
struct block_report *rep_pair,
struct srclist *src_list,
+ struct strlist *func_list,
void (*func)(struct hist_entry *,
struct hist_entry *))
{
@@ -911,7 +917,7 @@ int block_info__match_report(struct block_report *rep_base,
struct block_hist *bh_pair = &rep_pair->hist;
block_hists_match(&bh_base->block_hists, &bh_pair->block_hists,
- src_list, func);
+ src_list, func_list, func);
return 0;
}
diff --git a/tools/perf/util/block-info.h b/tools/perf/util/block-info.h
index 4e22bce81731..2b440cef4ef7 100644
--- a/tools/perf/util/block-info.h
+++ b/tools/perf/util/block-info.h
@@ -70,7 +70,7 @@ static inline void __block_info__zput(struct block_info **bi)
#define block_info__zput(bi) __block_info__zput(&bi)
int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right,
- struct srclist *src_list __maybe_unused);
+ struct srclist *src_list, struct strlist *func_list);
int64_t block_info__cmp(struct perf_hpp_fmt *fmt __maybe_unused,
struct hist_entry *left, struct hist_entry *right);
@@ -108,12 +108,14 @@ bool block_srclist_matched(struct srclist *slist, char *rel_path,
void block_hists_match(struct hists *hists_base,
struct hists *hists_pair,
struct srclist *src_list,
+ struct strlist *func_list,
void (*func)(struct hist_entry *,
struct hist_entry *));
int block_info__match_report(struct block_report *rep_base,
struct block_report *rep_pair,
struct srclist *src_list,
+ struct strlist *func_list,
void (*func)(struct hist_entry *,
struct hist_entry *));
--
2.17.1
Powered by blists - more mailing lists