LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jin Yao <yao.jin@linux.intel.com>
To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com
Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com,
	Jin Yao <yao.jin@linux.intel.com>
Subject: [PATCH v2 13/14] perf util: Filter out blocks by name of changed functions
Date: Fri, 13 Mar 2020 15:11:17 +0800	[thread overview]
Message-ID: <20200313071118.11983-14-yao.jin@linux.intel.com> (raw)
In-Reply-To: <20200313071118.11983-1-yao.jin@linux.intel.com>

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@linux.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


  parent reply	other threads:[~2020-03-13  7:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13  7:11 [PATCH v2 00/14] perf: Stream comparison Jin Yao
2020-03-13  7:11 ` [PATCH v2 01/14] perf util: Create source line mapping table Jin Yao
2020-03-13  7:11 ` [PATCH v2 02/14] perf util: Create streams for managing top N hottest callchains Jin Yao
2020-03-13  7:11 ` [PATCH v2 03/14] perf util: Return per-event callchain streams Jin Yao
2020-03-13  7:11 ` [PATCH v2 04/14] perf util: Compare two streams Jin Yao
2020-03-13  7:11 ` [PATCH v2 05/14] perf util: Calculate the sum of all streams hits Jin Yao
2020-03-13  7:11 ` [PATCH v2 06/14] perf util: Report hot streams Jin Yao
2020-03-13  7:11 ` [PATCH v2 07/14] perf diff: Support hot streams comparison Jin Yao
2020-03-13  7:11 ` [PATCH v2 08/14] perf util: Add new block info functions for top N hot blocks comparison Jin Yao
2020-03-13  7:11 ` [PATCH v2 09/14] perf util: Add new block info fmts for showing " Jin Yao
2020-03-13  7:11 ` [PATCH v2 10/14] perf util: Enable block source line comparison Jin Yao
2020-03-13  7:11 ` [PATCH v2 11/14] perf diff: support hot blocks comparison Jin Yao
2020-03-13  7:11 ` [PATCH v2 12/14] perf util: Filter out streams by name of changed functions Jin Yao
2020-03-13  7:11 ` Jin Yao [this message]
2020-03-13  7:11 ` [PATCH v2 14/14] perf diff: Filter out streams by " Jin Yao
2020-03-18 10:19 ` [PATCH v2 00/14] perf: Stream comparison Jiri Olsa
2020-03-19  1:48   ` Jin, Yao
2020-03-23 11:05 ` Jiri Olsa
2020-03-23 13:59   ` Jin, Yao
2020-03-23 14:37     ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200313071118.11983-14-yao.jin@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --subject='Re: [PATCH v2 13/14] perf util: Filter out blocks by name of changed functions' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).