summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_record.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-06-15 14:36:43 -0700
committerYabin Cui <yabinc@google.com>2015-06-15 14:37:26 -0700
commit6e8a9a4e52242f82104644bca0318284b3bbdd6b (patch)
tree961422e237f09d7bdc80944bdca0841d49626496 /simpleperf/cmd_record.cpp
parentdecc11c6b5f88c72d2ca72be5efe6064f2176d1c (diff)
downloadextras-6e8a9a4e52242f82104644bca0318284b3bbdd6b.tar.gz
Simpleperf: support callchain sampling in record command.
Bug: 19483574 Change-Id: Icd8ed7c316144fc51d54f196872061533bdeef2b
Diffstat (limited to 'simpleperf/cmd_record.cpp')
-rw-r--r--simpleperf/cmd_record.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp
index 83fa593a..5339d501 100644
--- a/simpleperf/cmd_record.cpp
+++ b/simpleperf/cmd_record.cpp
@@ -58,6 +58,7 @@ class RecordCommand : public Command {
" to find all possible event names.\n"
" -f freq Set event sample frequency.\n"
" -F freq Same as '-f freq'.\n"
+ " -g Enables call-graph recording.\n"
" -j branch_filter1,branch_filter2,...\n"
" Enable taken branch stack sampling. Each sample\n"
" captures a series of consecutive taken branches.\n"
@@ -75,6 +76,7 @@ class RecordCommand : public Command {
sample_freq_(1000),
system_wide_collection_(false),
branch_sampling_(0),
+ callchain_sampling_(false),
measured_event_type_(nullptr),
perf_mmap_pages_(256),
record_filename_("perf.data") {
@@ -106,6 +108,7 @@ class RecordCommand : public Command {
bool system_wide_collection_;
uint64_t branch_sampling_;
+ bool callchain_sampling_;
const EventType* measured_event_type_;
EventSelectionSet event_selection_set_;
@@ -246,6 +249,8 @@ bool RecordCommand::ParseOptions(const std::vector<std::string>& args,
return false;
}
use_sample_freq_ = true;
+ } else if (args[i] == "-g") {
+ callchain_sampling_ = true;
} else if (args[i] == "-j") {
if (!NextArgumentOrError(args, &i)) {
return false;
@@ -299,6 +304,9 @@ bool RecordCommand::SetEventSelection() {
if (!event_selection_set_.SetBranchSampling(branch_sampling_)) {
return false;
}
+ if (callchain_sampling_) {
+ event_selection_set_.EnableCallChainSampling();
+ }
return true;
}