From: Irina Tirdea <irina.tirdea@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Ingo Molnar <mingo@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: LKML <linux-kernel@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Pekka Enberg <penberg@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Irina Tirdea <irina.tirdea@intel.com>
Subject: [PATCH v4 5/6] perf tools: Try to find cross-built addr2line path
Date: Tue, 16 Oct 2012 02:33:39 +0300 [thread overview]
Message-ID: <1350344020-8071-6-git-send-email-irina.tirdea@gmail.com> (raw)
In-Reply-To: <1350344020-8071-1-git-send-email-irina.tirdea@gmail.com>
From: Irina Tirdea <irina.tirdea@intel.com>
As we have architecture information of saved perf.data file, we can
also try to find cross-built addr2line path. The predefined triplets
include support for Android (arm, x86 and mips architectures).
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
tools/perf/Documentation/android.txt | 18 ++++++++++++++++++
tools/perf/arch/common.c | 6 ++++++
tools/perf/arch/common.h | 2 ++
tools/perf/builtin-annotate.c | 6 ++++++
tools/perf/builtin-report.c | 6 ++++++
tools/perf/util/sort.c | 1 +
tools/perf/util/sort.h | 1 -
7 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/android.txt b/tools/perf/Documentation/android.txt
index 24fd01c..c2a8017 100644
--- a/tools/perf/Documentation/android.txt
+++ b/tools/perf/Documentation/android.txt
@@ -74,3 +74,21 @@ IV. Run perf
------------------------------------------------
Run perf on your device/emulator to which you previously connected using adb:
# ./data/perf
+
+V. Analyze data recorded in Android on the host
+------------------------------------------------
+perf report and perf annotate use objdump and addr2line tools from Linux.
+For analyzing data recorded for a different architecture you need to use the
+versions provided in the toolchain for that architecture. The detection of the
+proper toolchain is done at runtime; all you need to do is set some environment
+variables before running perf annotate/report:
+1. set CROSS_COMPILE
+ export CROSS_COMPILE=${NDK_TOOLCHAIN}
+or
+2. add the path to the toolchain to PATH
+ export PATH=$PATH:${ANDROID_TOOLCHAIN}
+or
+3. set the Android environment if you have the source tree
+(this will set $PATH for you as mentioned above)
+ source build/envsetup.sh
+ lunch
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c
index 2367b25..18ea475 100644
--- a/tools/perf/arch/common.c
+++ b/tools/perf/arch/common.c
@@ -176,3 +176,9 @@ int perf_session_env__lookup_objdump(struct perf_session_env *env)
return perf_session_env__lookup_binutils_path(env, "objdump",
&objdump_path);
}
+
+int perf_session_env__lookup_addr2line(struct perf_session_env *env)
+{
+ return perf_session_env__lookup_binutils_path(env, "addr2line",
+ &addr2line_path);
+}
diff --git a/tools/perf/arch/common.h b/tools/perf/arch/common.h
index ede246e..e78cebd 100644
--- a/tools/perf/arch/common.h
+++ b/tools/perf/arch/common.h
@@ -4,7 +4,9 @@
#include "../util/session.h"
extern const char *objdump_path;
+extern const char *addr2line_path;
int perf_session_env__lookup_objdump(struct perf_session_env *env);
+int perf_session_env__lookup_addr2line(struct perf_session_env *env);
#endif /* ARCH_PERF_COMMON_H */
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index e4df5da..0f46ec6 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -193,6 +193,12 @@ static int __cmd_annotate(struct perf_annotate *ann)
goto out_delete;
}
+ if (!addr2line_path) {
+ ret = perf_session_env__lookup_addr2line(&session->header.env);
+ if (ret)
+ goto out_delete;
+ }
+
ret = perf_session__process_events(session, &ann->tool);
if (ret)
goto out_delete;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 9c0fe68..692462c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -682,6 +682,12 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
goto error;
}
+ if (!addr2line_path) {
+ ret = perf_session_env__lookup_addr2line(&session->header.env);
+ if (ret)
+ goto error;
+ }
+
if (sort__branch_mode == -1 && has_br_stack)
sort__branch_mode = 1;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index d45e406..e526158 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,5 +1,6 @@
#include "sort.h"
#include "hist.h"
+#include "../arch/common.h"
regex_t parent_regex;
const char default_parent_pattern[] = "^sys_|^do_page_fault";
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index c8e58f6..13761d8 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -139,7 +139,6 @@ struct sort_entry {
extern struct sort_entry sort_thread;
extern struct list_head hist_entry__sort_list;
-extern const char *addr2line_path;
void setup_sorting(const char * const usagestr[], const struct option *opts);
extern int sort_dimension__add(const char *);
--
1.7.9.5
next prev parent reply other threads:[~2012-10-15 23:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 23:33 [PATCH v4 0/6] perf tools: fixes for Android Irina Tirdea
2012-10-15 23:33 ` [PATCH v4 1/6] perf tools: configure tmp path at build time Irina Tirdea
2012-10-16 15:18 ` Arnaldo Carvalho de Melo
2012-10-16 16:48 ` Christoph Hellwig
2012-10-21 16:24 ` Ingo Molnar
2012-10-22 7:38 ` Irina Tirdea
2012-10-15 23:33 ` [PATCH v4 2/6] perf tools: configure shell path at compile time Irina Tirdea
2012-10-16 15:19 ` Arnaldo Carvalho de Melo
2012-10-15 23:33 ` [PATCH v4 3/6] perf tools: add --addr2line command line option Irina Tirdea
2012-10-16 15:21 ` Arnaldo Carvalho de Melo
2012-10-22 9:06 ` Irina Tirdea
2012-10-15 23:33 ` [PATCH v4 4/6] perf tools: Try to find cross-built objdump path Irina Tirdea
2012-10-16 15:26 ` Arnaldo Carvalho de Melo
2012-10-17 4:22 ` Namhyung Kim
2012-10-25 7:59 ` [tip:perf/core] " tip-bot for Irina Tirdea
2012-10-15 23:33 ` Irina Tirdea [this message]
2012-10-16 15:26 ` [PATCH v4 5/6] perf tools: Try to find cross-built addr2line path Arnaldo Carvalho de Melo
2012-10-15 23:33 ` [PATCH v4 6/6] perf stat: implement --big-num grouping Irina Tirdea
2012-10-16 16:49 ` Christoph Hellwig
2012-10-21 16:28 ` Ingo Molnar
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=1350344020-8071-6-git-send-email-irina.tirdea@gmail.com \
--to=irina.tirdea@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=irina.tirdea@intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=penberg@kernel.org \
--cc=rostedt@goodmis.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
Powered by JetHome