summaryrefslogtreecommitdiff
path: root/simpleperf/sample_tree.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-06-29 12:18:11 -0700
committerYabin Cui <yabinc@google.com>2016-06-29 13:32:57 -0700
commit9970a2344333f2c19d9126cfec4f833f50ff2f22 (patch)
tree49fb22bf07f936b96ef63a5ffae87e3c9336eb52 /simpleperf/sample_tree.h
parentd937202a3b23e6908c2109d5a96da237ee9cbba8 (diff)
downloadextras-9970a2344333f2c19d9126cfec4f833f50ff2f22.tar.gz
Simpleperf: add vaddr_in_file sort key in report command.
Currently report command can't report more details than function name. After adding vaddr_in_file sort key, it can report the place of the instruction being sampled. vaddr_in_file is the instruction's virtual address in elf file, which matches output generated by objdump. Bug: 29826956 Test: run simpleperf_unit_test. Change-Id: Ifad4dfb7c60014a03c01ffbfd0b972858f1a4884
Diffstat (limited to 'simpleperf/sample_tree.h')
-rw-r--r--simpleperf/sample_tree.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/simpleperf/sample_tree.h b/simpleperf/sample_tree.h
index 86becbe3..eb4e38ae 100644
--- a/simpleperf/sample_tree.h
+++ b/simpleperf/sample_tree.h
@@ -54,6 +54,7 @@ class SampleTreeBuilder {
SampleTreeBuilder(SampleComparator<EntryT> comparator)
: sample_set_(comparator),
accumulate_callchain_(false),
+ sample_comparator_(comparator),
callchain_sample_set_(comparator),
use_branch_address_(false),
build_callchain_(false),
@@ -189,9 +190,7 @@ class SampleTreeBuilder {
const std::vector<EntryT*>& callchain,
const AccumulateInfoT& acc_info) = 0;
virtual const ThreadEntry* GetThreadOfSample(EntryT*) = 0;
- virtual void InsertCallChainForSample(EntryT* sample,
- const std::vector<EntryT*>& callchain,
- const AccumulateInfoT& acc_info) = 0;
+ virtual uint64_t GetPeriodForCallChain(const AccumulateInfoT& acc_info) = 0;
virtual bool FilterSample(const EntryT*) { return true; }
virtual void UpdateSummary(const EntryT*) {}
@@ -245,10 +244,20 @@ class SampleTreeBuilder {
return InsertSample(std::move(sample));
}
+ void InsertCallChainForSample(EntryT* sample,
+ const std::vector<EntryT*>& callchain,
+ const AccumulateInfoT& acc_info) {
+ uint64_t period = GetPeriodForCallChain(acc_info);
+ sample->callchain.AddCallChain(callchain, period, [&](const EntryT* s1, const EntryT* s2) {
+ return sample_comparator_.IsSameSample(s1, s2);
+ });
+ }
+
std::set<EntryT*, SampleComparator<EntryT>> sample_set_;
bool accumulate_callchain_;
private:
+ const SampleComparator<EntryT> sample_comparator_;
// If a CallChainSample is filtered out, it is stored in callchain_sample_set_
// and only used in other EntryT's callchain.
std::set<EntryT*, SampleComparator<EntryT>> callchain_sample_set_;