Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1400870ybh; Fri, 13 Mar 2020 00:14:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvprokO37yuvQFDZ5X0JDpKArYkLAdlEki2T04sjjyNQKrswVqZmq2vfpb8Vbd5BbLMcTKb X-Received: by 2002:a05:6808:298:: with SMTP id z24mr5716957oic.67.1584083671981; Fri, 13 Mar 2020 00:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584083671; cv=none; d=google.com; s=arc-20160816; b=de0H71qH5XlTItY5YDj0kxlnnA0BO1CM5+5eyEI8MFo6IS0FoeQ38jAsOCtEH8w1SN wKxB56C02AVF06JeSnUzSbwzYjBzpMdNyLHA+lTlwsgTmBl/Lmyq7kInV9r1pjaRgAmf jhSyDSfjgx2ks+AyblmvnQtlK3YH0PSgSMqewJek0l987svknYAKURYT+1hCJPoHepC8 csa6lOdiWFBMbr7C4te5wQMpR9i3PypvSAYbrhzpOw15XGG3amXa3Cu90ca2rA63k07K m/rpWg7a8EOHluZOfaIP3/klywL4Qg0HVQVHvzqBLNF4tFKFGT3xlQSwY0wZqSfFEjJ3 Jfzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=lXea1lH/MY+RyYMNs6cKUXoBKyaS+4Ei+RY+J5Sh7oU=; b=UAa3b4qyEW0bNWAlCYuVA+kf+xZVxXwYoQJKNBmMi0vjvWI4ct2L4MW0XVpkqr1rDI vpaDUF2EySG7DhcDMAfz4ayJTy7+XWGjakDxLKa5Q0GajC0I4a6KAGYl5tLAFpp9eS9B yaQkffEng6+mdHj0aD0IMxPOmUcGo0nx0D1Lw1Q/f3JnuPmT8wMuZfY7bd/IXaoexGfd PWQ9NYbxxGFkH8MwR/jpcVxi0XM0XJ6H/mpG/e3bPfyOHVx3LDkq2fkJuyMQroqDw6KY B49LQnUSKTZf11t8QCQ5Q7RWRp39ORZX3MS1yMqj3RRhZq1h97fmeaqmkBurKSeSA5Ba bskA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k28si1963302otb.94.2020.03.13.00.14.19; Fri, 13 Mar 2020 00:14:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726828AbgCMHM0 (ORCPT + 99 others); Fri, 13 Mar 2020 03:12:26 -0400 Received: from mga02.intel.com ([134.134.136.20]:7824 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbgCMHMZ (ORCPT ); Fri, 13 Mar 2020 03:12:25 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 00:12:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,547,1574150400"; d="scan'208";a="266642318" Received: from kbl.sh.intel.com ([10.239.159.24]) by fmsmga004.fm.intel.com with ESMTP; 13 Mar 2020 00:12:21 -0700 From: Jin Yao 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 Subject: [PATCH v2 13/14] perf util: Filter out blocks by name of changed functions Date: Fri, 13 Mar 2020 15:11:17 +0800 Message-Id: <20200313071118.11983-14-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200313071118.11983-1-yao.jin@linux.intel.com> References: <20200313071118.11983-1-yao.jin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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