From: Kan Liang <kan.liang@intel.com>
To: acme@kernel.org, jolsa@redhat.com, namhyung@kernel.org
Cc: linux-kernel@vger.kernel.org, ak@linux.intel.com,
Kan Liang <kan.liang@intel.com>
Subject: [PATCH V5 2/3] perf tool: new function to compare build_ids
Date: Mon, 24 Nov 2014 11:00:28 -0500 [thread overview]
Message-ID: <1416844829-26945-2-git-send-email-kan.liang@intel.com> (raw)
In-Reply-To: <1416844829-26945-1-git-send-email-kan.liang@intel.com>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
New function to compare the build_ids between different DSOs
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Kan Liang <kan.liang@intel.com>
---
tools/perf/util/dso.c | 33 +++++++++++++++++++++++++++++++++
tools/perf/util/dso.h | 3 +++
2 files changed, 36 insertions(+)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 45be944..e53ce26 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1087,3 +1087,36 @@ enum dso_type dso__type(struct dso *dso, struct machine *machine)
return dso__type_fd(fd);
}
+
+bool dsos__build_ids_equal(struct dsos *dsos_a, struct dsos *dsos_b)
+{
+ bool ret;
+ struct dso *dso_a, *dso_b;
+
+ list_for_each_entry(dso_a, &dsos_a->head, node) {
+ dso_b = dsos__find(dsos_b, dso_a->long_name, false);
+ if (dso_b == NULL)
+ return false;
+
+ if (memcmp(dso_a->build_id, dso_b->build_id, sizeof(dso_a->build_id)))
+ return false;
+
+ /* Mark that we compared this one */
+ dso_b->visited = 1;
+ }
+
+ /*
+ * Now check if there are dsos in dsos_b that are not in
+ * dsos_a
+ */
+
+ ret = true;
+ list_for_each_entry(dso_b, &dsos_b->head, node) {
+ if (!dso_b->visited)
+ ret = false;
+ else
+ dso_b->visited = 0;
+ }
+
+ return ret;
+}
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 3782c82..371f826 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -117,6 +117,7 @@ struct dso {
u8 has_build_id:1;
u8 has_srcline:1;
u8 hit:1;
+ u8 visited:1;
u8 annotate_warned:1;
u8 short_name_allocated:1;
u8 long_name_allocated:1;
@@ -278,4 +279,6 @@ void dso__free_a2l(struct dso *dso);
enum dso_type dso__type(struct dso *dso, struct machine *machine);
+bool dsos__build_ids_equal(struct dsos *dsos_a, struct dsos *dsos_b);
+
#endif /* __PERF_DSO */
--
1.8.3.2
next prev parent reply other threads:[~2014-11-24 16:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 16:00 [PATCH V5 1/3] perf tool: Add sort key symoff for perf diff Kan Liang
2014-11-24 16:00 ` Kan Liang [this message]
2014-11-24 16:00 ` [PATCH V5 3/3] perf tool: check buildid for symoff Kan Liang
2014-11-25 11:51 ` Jiri Olsa
2014-11-26 16:10 ` Liang, Kan
2014-11-28 9:43 ` Jiri Olsa
2014-11-25 12:21 ` Jiri Olsa
2014-11-25 17:19 ` Liang, Kan
2014-11-27 2:05 ` Namhyung Kim
2014-11-27 14:09 ` Liang, Kan
2014-11-28 9:49 ` Jiri Olsa
2014-11-28 16:43 ` Liang, Kan
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=1416844829-26945-2-git-send-email-kan.liang@intel.com \
--to=kan.liang@intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).