diff options
author | Yabin Cui <yabinc@google.com> | 2015-12-05 00:15:38 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-12-05 00:15:38 +0000 |
commit | b9ca50b319d2083c5a92c468e54796b0e71a4ad9 (patch) | |
tree | d669a9e0da05254aab47edf54a529d36c3f46903 /simpleperf/event_selection_set.cpp | |
parent | 5d8fdbb6ff3d617e48198e12a2b1c10b48d22f79 (diff) | |
parent | a46794fa2963de93a9d25fd6945d3c58121e2ba6 (diff) | |
download | extras-b9ca50b319d2083c5a92c468e54796b0e71a4ad9.tar.gz |
Merge "Simpleperf: don't use ioctl(PERF_EVENT_IOC_ENABLE)."
Diffstat (limited to 'simpleperf/event_selection_set.cpp')
-rw-r--r-- | simpleperf/event_selection_set.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/simpleperf/event_selection_set.cpp b/simpleperf/event_selection_set.cpp index 02a16778..038e577e 100644 --- a/simpleperf/event_selection_set.cpp +++ b/simpleperf/event_selection_set.cpp @@ -81,7 +81,17 @@ void EventSelectionSet::UnionSampleType() { void EventSelectionSet::SetEnableOnExec(bool enable) { for (auto& selection : selections_) { - selection.event_attr.enable_on_exec = (enable ? 1 : 0); + // If sampling is enabled on exec, then it is disabled at startup, otherwise + // it should be enabled at startup. Don't use ioctl(PERF_EVENT_IOC_ENABLE) + // to enable it after perf_event_open(). Because some android kernels can't + // handle ioctl() well when cpu-hotplug happens. See http://b/25193162. + if (enable) { + selection.event_attr.enable_on_exec = 1; + selection.event_attr.disabled = 1; + } else { + selection.event_attr.enable_on_exec = 0; + selection.event_attr.disabled = 0; + } } } @@ -218,17 +228,6 @@ bool EventSelectionSet::OpenEventFiles(const std::vector<pid_t>& threads, return true; } -bool EventSelectionSet::EnableEvents() { - for (auto& selection : selections_) { - for (auto& event_fd : selection.event_fds) { - if (!event_fd->EnableEvent()) { - return false; - } - } - } - return true; -} - bool EventSelectionSet::ReadCounters(std::vector<CountersInfo>* counters) { counters->clear(); for (auto& selection : selections_) { |