summaryrefslogtreecommitdiff
path: root/simpleperf/sample_tree.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2017-12-13 11:31:53 -0800
committerYabin Cui <yabinc@google.com>2017-12-15 15:50:11 -0800
commit0338145e5418d73c97521c676d31c05e74e01fdd (patch)
tree01f7104a43a37dd0087f9502c4e9dc2c77d5c48f /simpleperf/sample_tree.h
parent4f70f2a2bf7f625ac24e8f470eaf9ef33c13a8bf (diff)
downloadextras-0338145e5418d73c97521c676d31c05e74e01fdd.tar.gz
simpleperf: report unwinding failures.
1. When --log debug is used, store unwinding results in UnwindingResultRecords in perf.data. 2. Use unwinding_result_reporter.py to report unwinding results. This is to help finding different unwinding failures. Bug: http://b/69383534 Test: run simpleperf_unit_test. Test: run unwinding_result_reporter.py manually. Change-Id: I6d7f107e9758b1ec55ed35b49657bb41d47e2178
Diffstat (limited to 'simpleperf/sample_tree.h')
-rw-r--r--simpleperf/sample_tree.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/simpleperf/sample_tree.h b/simpleperf/sample_tree.h
index 18194754..36c6adc1 100644
--- a/simpleperf/sample_tree.h
+++ b/simpleperf/sample_tree.h
@@ -20,13 +20,15 @@
#include <unordered_map>
#include "callchain.h"
-#include "dwarf_unwind.h"
+#include "OfflineUnwinder.h"
#include "perf_regs.h"
#include "record.h"
#include "SampleComparator.h"
#include "SampleDisplayer.h"
#include "thread_tree.h"
+using namespace simpleperf;
+
// A SampleTree is a collection of samples. A profiling report is mainly about
// constructing a SampleTree and display it. There are three steps involved:
// build the tree, sort the tree, and display it. For example, if we want to
@@ -60,8 +62,7 @@ class SampleTreeBuilder {
callchain_sample_set_(comparator),
use_branch_address_(false),
build_callchain_(false),
- use_caller_as_callchain_root_(false),
- strict_unwind_arch_check_(false) {}
+ use_caller_as_callchain_root_(false) {}
virtual ~SampleTreeBuilder() {}
@@ -76,7 +77,9 @@ class SampleTreeBuilder {
accumulate_callchain_ = accumulate_callchain;
build_callchain_ = build_callchain;
use_caller_as_callchain_root_ = use_caller_as_callchain_root;
- strict_unwind_arch_check_ = strict_unwind_arch_check;
+ if (accumulate_callchain_) {
+ offline_unwinder_.reset(new OfflineUnwinder(strict_unwind_arch_check, false));
+ }
}
void ProcessSampleRecord(const SampleRecord& r) {
@@ -113,8 +116,9 @@ class SampleTreeBuilder {
r.regs_user_data.regs);
std::vector<uint64_t> user_ips;
std::vector<uint64_t> sps;
- if (UnwindCallChain(r.regs_user_data.abi, *thread, regs, r.stack_user_data.data,
- r.GetValidStackSize(), strict_unwind_arch_check_, &user_ips, &sps)) {
+ if (offline_unwinder_->UnwindCallChain(r.regs_user_data.abi, *thread, regs,
+ r.stack_user_data.data, r.GetValidStackSize(),
+ &user_ips, &sps)) {
ips.push_back(PERF_CONTEXT_USER);
ips.insert(ips.end(), user_ips.begin(), user_ips.end());
}
@@ -302,7 +306,7 @@ class SampleTreeBuilder {
bool use_branch_address_;
bool build_callchain_;
bool use_caller_as_callchain_root_;
- bool strict_unwind_arch_check_;
+ std::unique_ptr<OfflineUnwinder> offline_unwinder_;
};
template <typename EntryT>