summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-04-18 22:27:34 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-04-18 22:27:36 +0000
commit05af0c8c65fa9dd0b1cdc119fedb96caf9f261a7 (patch)
tree023db521afd6835ebe87da732270c2a1d3c2ccb0
parent30257fab6d3f3ce0eff6b37b7dcce79c5b1aa268 (diff)
parent6da361fd2ff9169954dcfb3588cacc3b4b6df19c (diff)
downloadextras-05af0c8c65fa9dd0b1cdc119fedb96caf9f261a7.tar.gz
Merge "simpleperf: add warning for `--call-graph fp` option on arm."
-rw-r--r--simpleperf/README.md6
-rw-r--r--simpleperf/cmd_record.cpp7
-rw-r--r--simpleperf/cmd_record_test.cpp12
3 files changed, 25 insertions, 0 deletions
diff --git a/simpleperf/README.md b/simpleperf/README.md
index 5412f906..5700c8aa 100644
--- a/simpleperf/README.md
+++ b/simpleperf/README.md
@@ -582,6 +582,12 @@ but not well on arm).
angler:/data/data/com.example.sudogame $./simpleperf record -p 10324 --call-graph fp --symfs . --duration 30
simpleperf I 01-01 10:03:58 11267 11267 cmd_record.cpp:341] Samples recorded: 56736. Samples lost: 0.
+**Recording stack frame based call graph doesn't work well on arm architecture,**
+**even if compiled using -O0 -g -fno-omit-frame-pointer options. It is because**
+**the kernel can't unwind user stack containing both arm/thumb code. So please**
+**consider using dwarf based call graph on arm architecture, or profiling in**
+**aarch64 environment.**
+
#### Report call graph
Report accumulated period. In the table below, the first column is “Children”,
it is the cpu cycle percentage of a function and functions called by that
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp
index 1cbb86cd..f1bf7aad 100644
--- a/simpleperf/cmd_record.cpp
+++ b/simpleperf/cmd_record.cpp
@@ -559,6 +559,13 @@ bool RecordCommand::ParseOptions(const std::vector<std::string>& args,
}
}
+ if (fp_callchain_sampling_) {
+ if (GetBuildArch() == ARCH_ARM) {
+ LOG(WARNING) << "`--callgraph fp` option doesn't work well on arm architecture, "
+ << "consider using `-g` option or profiling on aarch64 architecture.";
+ }
+ }
+
if (system_wide_collection_ && event_selection_set_.HasMonitoredTarget()) {
LOG(ERROR) << "Record system wide and existing processes/threads can't be "
"used at the same time.";
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 3820c2cd..2cfa57c5 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -136,6 +136,18 @@ TEST(record_cmd, fp_callchain_sampling) {
ASSERT_TRUE(RunRecordCmd({"--call-graph", "fp"}));
}
+TEST(record_cmd, fp_callchain_sampling_warning_on_arm) {
+ if (GetBuildArch() != ARCH_ARM) {
+ GTEST_LOG_(INFO) << "This test does nothing as it only tests on arm arch.";
+ return;
+ }
+ ASSERT_EXIT(
+ {
+ exit(RunRecordCmd({"--call-graph", "fp"}) ? 0 : 1);
+ },
+ testing::ExitedWithCode(0), "doesn't work well on arm");
+}
+
TEST(record_cmd, system_wide_fp_callchain_sampling) {
TEST_IN_ROOT(ASSERT_TRUE(RunRecordCmd({"-a", "--call-graph", "fp"})));
}