diff options
author | Yabin Cui <yabinc@google.com> | 2016-10-24 13:38:38 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-10-31 10:40:03 -0700 |
commit | c5b4a3106a0845d1bd8fd2c1b1c724eeb719ec62 (patch) | |
tree | 8d045224b547f708cadcd4c7c23476b0a78e262e /simpleperf/thread_tree.cpp | |
parent | d2fcab88ef855a9a415159b669f7ea7e00f5a575 (diff) | |
download | extras-c5b4a3106a0845d1bd8fd2c1b1c724eeb719ec62.tar.gz |
simpleperf: dump file feature section.
For `record --dump-symbols` option, change from dumping
DsoRecord and SymbolRecord to dumping file feature section.
It is to avoid reading symbols from elf files during recording,
which takes a lot of time. And we don't want to mix optional
data (the symbol tables) with necessary data (the profiling records).
Bug: http://b/32340274
Test: run simpleperf_unit_test.
Test: run simpleperf runtest.py.
Change-Id: I0a387de243afac93486fc885f223a58060ec07f4
Diffstat (limited to 'simpleperf/thread_tree.cpp')
-rw-r--r-- | simpleperf/thread_tree.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/simpleperf/thread_tree.cpp b/simpleperf/thread_tree.cpp index 69dab725..5868502b 100644 --- a/simpleperf/thread_tree.cpp +++ b/simpleperf/thread_tree.cpp @@ -231,7 +231,7 @@ const Symbol* ThreadTree::FindSymbol(const MapEntry* map, uint64_t ip, std::string name = android::base::StringPrintf( "%s%s[+%" PRIx64 "]", (show_mark_for_unknown_symbol_ ? "*" : ""), dso->FileName().c_str(), vaddr_in_file); - dso->InsertSymbol(Symbol(name, vaddr_in_file, 1)); + dso->AddUnknownSymbol(vaddr_in_file, name); symbol = dso->FindSymbol(vaddr_in_file); CHECK(symbol != nullptr); } else { @@ -256,6 +256,19 @@ void ThreadTree::ClearThreadAndMap() { map_storage_.clear(); } +void ThreadTree::AddDsoInfo(const std::string& file_path, uint32_t file_type, + uint64_t min_vaddr, std::vector<Symbol>* symbols) { + DsoType dso_type = static_cast<DsoType>(file_type); + Dso* dso = nullptr; + if (dso_type == DSO_KERNEL || dso_type == DSO_KERNEL_MODULE) { + dso = FindKernelDsoOrNew(file_path); + } else { + dso = FindUserDsoOrNew(file_path); + } + dso->SetMinVirtualAddress(min_vaddr); + dso->SetSymbols(symbols); +} + void ThreadTree::Update(const Record& record) { if (record.type() == PERF_RECORD_MMAP) { const MmapRecord& r = *static_cast<const MmapRecord*>(&record); @@ -287,21 +300,6 @@ void ThreadTree::Update(const Record& record) { } else if (record.type() == SIMPLE_PERF_RECORD_KERNEL_SYMBOL) { const auto& r = *static_cast<const KernelSymbolRecord*>(&record); Dso::SetKallsyms(std::move(r.kallsyms)); - } else if (record.type() == SIMPLE_PERF_RECORD_DSO) { - auto& r = *static_cast<const DsoRecord*>(&record); - Dso* dso = nullptr; - if (r.dso_type == DSO_KERNEL || r.dso_type == DSO_KERNEL_MODULE) { - dso = FindKernelDsoOrNew(r.dso_name); - } else { - dso = FindUserDsoOrNew(r.dso_name); - } - dso->SetMinVirtualAddress(r.min_vaddr); - dso_id_to_dso_map_[r.dso_id] = dso; - } else if (record.type() == SIMPLE_PERF_RECORD_SYMBOL) { - auto& r = *static_cast<const SymbolRecord*>(&record); - Dso* dso = dso_id_to_dso_map_[r.dso_id]; - CHECK(dso != nullptr); - dso->InsertSymbol(Symbol(r.name, r.addr, r.len)); } } |