summaryrefslogtreecommitdiff
path: root/simpleperf/perf_regs.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2017-12-10 13:09:07 -0800
committerYabin Cui <yabinc@google.com>2017-12-12 14:08:13 -0800
commit81a9d33dd0d753e4d4915dfb6f453b916be08813 (patch)
tree31cb95c6b615187b771565bab5e730cab49c56cb /simpleperf/perf_regs.cpp
parent36eb3ba517453b6ecea815af860c5a136ac1fa42 (diff)
downloadextras-81a9d33dd0d753e4d4915dfb6f453b916be08813.tar.gz
simpleperf: Use CallChainJoiner.
1. In record cmd, split most code in Run() into three functions to make it easier to maintain. 2. In record cmd, use CallChainJoiner by default when -g option is used. And allow using --no-callchain-joiner option to disable the joiner, and --callchain-joiner-min-matching-nodes to adjust the joiner. 3. Adjust the interface of UnwindCallChain() to return sps used by the joiner. 4. Add functions in SampleRecord to use callchains returned by the joiner. Add CallChainRecord to keep callchains returned by the joiner for debugging. 5. In dump cmd, show callchains of SampleRecord and CallChainRecord for debugging. Bug: http://b/69383534 Test: run simpleperf_unit_test. Test: run python test.py. Change-Id: I951b169dfba0f7c50b6d4d741df83f02f8010626
Diffstat (limited to 'simpleperf/perf_regs.cpp')
-rw-r--r--simpleperf/perf_regs.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/simpleperf/perf_regs.cpp b/simpleperf/perf_regs.cpp
index 6aa8bad0..33c64917 100644
--- a/simpleperf/perf_regs.cpp
+++ b/simpleperf/perf_regs.cpp
@@ -233,3 +233,22 @@ bool GetSpRegValue(const RegSet& regs, ArchType arch, uint64_t* value) {
}
return GetRegValue(regs, regno, value);
}
+
+bool GetIpRegValue(const RegSet& regs, ArchType arch, uint64_t* value) {
+ size_t regno;
+ switch (arch) {
+ case ARCH_X86_64:
+ case ARCH_X86_32:
+ regno = PERF_REG_X86_IP;
+ break;
+ case ARCH_ARM:
+ regno = PERF_REG_ARM_PC;
+ break;
+ case ARCH_ARM64:
+ regno = PERF_REG_ARM64_PC;
+ break;
+ default:
+ return false;
+ }
+ return GetRegValue(regs, regno, value);
+}