From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Mike Galbraith" <efault@gmx.de>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Paul Mackerras" <paulus@samba.org>
Subject: [PATCH 5/9] perf build-id: Move the routine to find DSOs with hits to the lib
Date: Wed, 3 Feb 2010 16:52:04 -0200 [thread overview]
Message-ID: <1265223128-11786-5-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1265223128-11786-1-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Because 'perf record' will have to find the build-ids in after we stop
recording, so as to reduce even more the impact in the workload while we do the
measurement.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile | 2 +
tools/perf/builtin-buildid-list.c | 31 +---------------------------
tools/perf/util/build-id.c | 39 +++++++++++++++++++++++++++++++++++++
tools/perf/util/build-id.h | 8 +++++++
4 files changed, 51 insertions(+), 29 deletions(-)
create mode 100644 tools/perf/util/build-id.c
create mode 100644 tools/perf/util/build-id.h
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 4296930..3a5fb36 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -357,6 +357,7 @@ LIB_H += util/include/asm/uaccess.h
LIB_H += perf.h
LIB_H += util/cache.h
LIB_H += util/callchain.h
+LIB_H += util/build-id.h
LIB_H += util/debug.h
LIB_H += util/debugfs.h
LIB_H += util/event.h
@@ -390,6 +391,7 @@ LIB_H += util/probe-event.h
LIB_OBJS += util/abspath.o
LIB_OBJS += util/alias.o
+LIB_OBJS += util/build-id.o
LIB_OBJS += util/config.o
LIB_OBJS += util/ctype.o
LIB_OBJS += util/debugfs.o
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 431f204..d0675c0 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -8,6 +8,7 @@
*/
#include "builtin.h"
#include "perf.h"
+#include "util/build-id.h"
#include "util/cache.h"
#include "util/debug.h"
#include "util/parse-options.h"
@@ -33,34 +34,6 @@ static const struct option options[] = {
OPT_END()
};
-static int build_id_list__process_event(event_t *event,
- struct perf_session *session)
-{
- struct addr_location al;
- u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
- struct thread *thread = perf_session__findnew(session, event->ip.pid);
-
- if (thread == NULL) {
- pr_err("problem processing %d event, skipping it.\n",
- event->header.type);
- return -1;
- }
-
- thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
- event->ip.ip, &al);
-
- if (al.map != NULL)
- al.map->dso->hit = 1;
-
- return 0;
-}
-
-static struct perf_event_ops build_id_list__event_ops = {
- .sample = build_id_list__process_event,
- .mmap = event__process_mmap,
- .fork = event__process_task,
-};
-
static int __cmd_buildid_list(void)
{
int err = -1;
@@ -71,7 +44,7 @@ static int __cmd_buildid_list(void)
return -1;
if (with_hits)
- perf_session__process_events(session, &build_id_list__event_ops);
+ perf_session__process_events(session, &build_id__mark_dso_hit_ops);
dsos__fprintf_buildid(stdout, with_hits);
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
new file mode 100644
index 0000000..04904b3
--- /dev/null
+++ b/tools/perf/util/build-id.c
@@ -0,0 +1,39 @@
+/*
+ * build-id.c
+ *
+ * build-id support
+ *
+ * Copyright (C) 2009, 2010 Red Hat Inc.
+ * Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com>
+ */
+#include "build-id.h"
+#include "event.h"
+#include "symbol.h"
+#include <linux/kernel.h>
+
+static int build_id__mark_dso_hit(event_t *event, struct perf_session *session)
+{
+ struct addr_location al;
+ u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
+ struct thread *thread = perf_session__findnew(session, event->ip.pid);
+
+ if (thread == NULL) {
+ pr_err("problem processing %d event, skipping it.\n",
+ event->header.type);
+ return -1;
+ }
+
+ thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
+ event->ip.ip, &al);
+
+ if (al.map != NULL)
+ al.map->dso->hit = 1;
+
+ return 0;
+}
+
+struct perf_event_ops build_id__mark_dso_hit_ops = {
+ .sample = build_id__mark_dso_hit,
+ .mmap = event__process_mmap,
+ .fork = event__process_task,
+};
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
new file mode 100644
index 0000000..1d981d6
--- /dev/null
+++ b/tools/perf/util/build-id.h
@@ -0,0 +1,8 @@
+#ifndef PERF_BUILD_ID_H_
+#define PERF_BUILD_ID_H_ 1
+
+#include "session.h"
+
+extern struct perf_event_ops build_id__mark_dso_hit_ops;
+
+#endif
--
1.6.2.5
next prev parent reply other threads:[~2010-02-03 18:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 18:52 [PATCH 1/9] perf symbols: Remove perf_session usage in symbols layer Arnaldo Carvalho de Melo
2010-02-03 18:52 ` [PATCH 2/9] perf symbols: Fixup vsyscall maps Arnaldo Carvalho de Melo
2010-02-03 18:52 ` [PATCH 3/9] perf symbols: Ditch vdso global variable Arnaldo Carvalho de Melo
2010-02-03 18:52 ` [PATCH 4/9] perf probe: Don't use a perf_session instance just to resolve symbols Arnaldo Carvalho de Melo
2010-02-03 18:52 ` Arnaldo Carvalho de Melo [this message]
2010-02-03 18:52 ` [PATCH 6/9] perf record: Stop intercepting events, use postprocessing to get build-ids Arnaldo Carvalho de Melo
2010-02-03 18:52 ` [PATCH 7/9] perf tools: Adjust some verbosity levels Arnaldo Carvalho de Melo
2010-02-03 18:52 ` [PATCH 8/9] perf annotate: fix it for non-prelinked *.so Arnaldo Carvalho de Melo
2010-02-04 6:31 ` Mike Galbraith
2010-02-04 9:54 ` [tip:perf/core] perf annotate: Fix perf top module symbol annotation tip-bot for Mike Galbraith
2010-02-04 19:34 ` [PATCH 8/9] perf annotate: fix it for non-prelinked *.so Kirill Smelkov
2010-02-04 19:48 ` Arnaldo Carvalho de Melo
2010-02-05 6:54 ` Mike Galbraith
2010-02-04 9:54 ` [tip:perf/core] perf annotate: Fix " tip-bot for Kirill Smelkov
2010-02-03 18:52 ` [PATCH 9/9] perf top: teach it to autolocate vmlinux Arnaldo Carvalho de Melo
2010-02-04 9:54 ` [tip:perf/core] perf top: Teach " tip-bot for Kirill Smelkov
2010-02-04 9:26 ` [PATCH 1/9] perf symbols: Remove perf_session usage in symbols layer Ingo Molnar
2010-02-04 13:04 ` Arnaldo Carvalho de Melo
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=1265223128-11786-5-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.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).