summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_report.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-07-13 16:23:13 -0700
committerYabin Cui <yabinc@google.com>2015-07-13 19:11:35 -0700
commit39d3caeb60a913276a2bbaa35f6a28dc3284eb52 (patch)
treeba64b75774bb2ebb1d895d1042277be305033f55 /simpleperf/cmd_report.cpp
parentf1732eeda661c221ce52a1d9506e9e52db8bf377 (diff)
downloadextras-39d3caeb60a913276a2bbaa35f6a28dc3284eb52.tar.gz
Simpleperf: support --vmlinux option in report command.
Bug: 22179177 Change-Id: I633da55c6bfcb106d69de9bda6b44bce24ffca8e
Diffstat (limited to 'simpleperf/cmd_report.cpp')
-rw-r--r--simpleperf/cmd_report.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/simpleperf/cmd_report.cpp b/simpleperf/cmd_report.cpp
index 4dc8126e..ab5b083e 100644
--- a/simpleperf/cmd_report.cpp
+++ b/simpleperf/cmd_report.cpp
@@ -248,7 +248,9 @@ class ReportCommand : public Command {
" include pid, tid, comm, dso, symbol, dso_from, dso_to, symbol_from\n"
" symbol_to. dso_from, dso_to, symbol_from, symbol_to can only be\n"
" used with -b option. Default keys are \"comm,pid,tid,dso,symbol\"\n"
- " --symfs <dir> Look for files with symbols relative to this directory.\n"),
+ " --symfs <dir> Look for files with symbols relative to this directory.\n"
+ " --vmlinux <file>\n"
+ " Parse kernel symbols from <file>.\n"),
record_filename_("perf.data"),
use_branch_address_(false),
accumulate_callchain_(false),
@@ -316,6 +318,7 @@ bool ReportCommand::Run(const std::vector<std::string>& args) {
bool ReportCommand::ParseOptions(const std::vector<std::string>& args) {
bool demangle = true;
std::string symfs_dir;
+ std::string vmlinux;
bool print_sample_count = false;
std::vector<std::string> sort_keys = {"comm", "pid", "tid", "dso", "symbol"};
for (size_t i = 0; i < args.size(); ++i) {
@@ -348,16 +351,24 @@ bool ReportCommand::ParseOptions(const std::vector<std::string>& args) {
return false;
}
symfs_dir = args[i];
+ } else if (args[i] == "--vmlinux") {
+ if (!NextArgumentOrError(args, &i)) {
+ return false;
+ }
+ vmlinux = args[i];
} else {
ReportUnknownOption(args, i);
return false;
}
}
- DsoFactory::SetDemangle(demangle);
- if (!DsoFactory::SetSymFsDir(symfs_dir)) {
+ DsoFactory::GetInstance()->SetDemangle(demangle);
+ if (!DsoFactory::GetInstance()->SetSymFsDir(symfs_dir)) {
return false;
}
+ if (!vmlinux.empty()) {
+ DsoFactory::GetInstance()->SetVmlinux(vmlinux);
+ }
if (!accumulate_callchain_) {
displayable_items_.push_back(
@@ -537,7 +548,7 @@ bool ReportCommand::ReadFeaturesFromRecordFile() {
for (auto& r : records) {
build_ids.push_back(std::make_pair(r.filename, r.build_id));
}
- DsoFactory::SetBuildIds(build_ids);
+ DsoFactory::GetInstance()->SetBuildIds(build_ids);
std::string arch = record_file_reader_->ReadFeatureString(PerfFileFormat::FEAT_ARCH);
if (!arch.empty()) {