diff options
author | Yabin Cui <yabinc@google.com> | 2016-08-19 17:24:37 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-08-19 17:32:10 -0700 |
commit | 994cb626a9b0ad6cb723a9dfa7c5e05849647c87 (patch) | |
tree | 29d9f84cc135da3194ec3d244b64d1803c51ca83 /simpleperf/cmd_stat.cpp | |
parent | cb0112fe640d7b8a9668f91d2cad7234bd63f880 (diff) | |
download | extras-994cb626a9b0ad6cb723a9dfa7c5e05849647c87.tar.gz |
simpleperf: monitor cpu hotplug in stat cmd.
Move code used to monitor cpu hotplug events
from cmd_record.cpp to event_selection_set.cpp,
so it can also be used by stat cmd.
Bug: http://b/29245608
Change-Id: I1f5f3268192aa5c98c0be9fc1de763352c08eab6
Test: run simpleperf stat, and online/offline a cpu.
Diffstat (limited to 'simpleperf/cmd_stat.cpp')
-rw-r--r-- | simpleperf/cmd_stat.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/simpleperf/cmd_stat.cpp b/simpleperf/cmd_stat.cpp index 5a0694e7..41992939 100644 --- a/simpleperf/cmd_stat.cpp +++ b/simpleperf/cmd_stat.cpp @@ -360,17 +360,20 @@ bool StatCommand::Run(const std::vector<std::string>& args) { return false; } } else { - if (cpus_.empty()) { - cpus_ = {-1}; - } - if (!event_selection_set_.OpenEventFilesForThreadsOnCpus(monitored_threads_, - cpus_)) { + std::vector<int> all_cpus = {-1}; + if (!event_selection_set_.OpenEventFilesForThreadsOnCpus( + monitored_threads_, cpus_.empty() ? all_cpus : cpus_)) { return false; } } // 4. Create IOEventLoop and add signal/periodic Events. IOEventLoop loop; + if (system_wide_collection_ || !cpus_.empty()) { + if (!event_selection_set_.HandleCpuHotplugEvents(loop, cpus_)) { + return false; + } + } if (!loop.AddSignalEvents({SIGCHLD, SIGINT, SIGTERM}, [&]() { return loop.ExitLoop(); })) { return false; |