summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_record.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2022-03-31 16:46:16 -0700
committerYabin Cui <yabinc@google.com>2022-03-31 17:03:59 -0700
commitc3cc93bbe0030a4ff53f17e07629a193cebad959 (patch)
treeec0c0dd02e68d1aa5a06949021fa0888e08b1195 /simpleperf/cmd_record.cpp
parent1c3f6a483ea2746f2470e886dacd76f30b834156 (diff)
downloadextras-c3cc93bbe0030a4ff53f17e07629a193cebad959.tar.gz
simpleperf: raise priority of stop recording events.
Simpleperf main thread handles several events, like processing records from record read thread, periodically checking JIT debug file updates, etc. Some events may take significant time to finish, and slow down reaction to stop recording events. To alleviate it, this CL raises priority of stop recording events. So they only need to wait for the currently running event. Bug: 227220328 Test: run simpleperf_unit_test Change-Id: Ib0160fe1da6d81cae8e71f25a5870d320706d2a9
Diffstat (limited to 'simpleperf/cmd_record.cpp')
-rw-r--r--simpleperf/cmd_record.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp
index 1c53dc1c..35cab822 100644
--- a/simpleperf/cmd_record.cpp
+++ b/simpleperf/cmd_record.cpp
@@ -629,25 +629,26 @@ bool RecordCommand::PrepareRecording(Workload* workload) {
}
IOEventLoop* loop = event_selection_set_.GetIOEventLoop();
auto exit_loop_callback = [loop]() { return loop->ExitLoop(); };
- if (!loop->AddSignalEvents({SIGCHLD, SIGINT, SIGTERM}, exit_loop_callback)) {
+ if (!loop->AddSignalEvents({SIGCHLD, SIGINT, SIGTERM}, exit_loop_callback, IOEventHighPriority)) {
return false;
}
// Only add an event for SIGHUP if we didn't inherit SIG_IGN (e.g. from nohup).
if (!SignalIsIgnored(SIGHUP)) {
- if (!loop->AddSignalEvent(SIGHUP, exit_loop_callback)) {
+ if (!loop->AddSignalEvent(SIGHUP, exit_loop_callback, IOEventHighPriority)) {
return false;
}
}
if (stop_signal_fd_ != -1) {
- if (!loop->AddReadEvent(stop_signal_fd_, exit_loop_callback)) {
+ if (!loop->AddReadEvent(stop_signal_fd_, exit_loop_callback, IOEventHighPriority)) {
return false;
}
}
if (duration_in_sec_ != 0) {
- if (!loop->AddPeriodicEvent(SecondToTimeval(duration_in_sec_),
- [loop]() { return loop->ExitLoop(); })) {
+ if (!loop->AddPeriodicEvent(
+ SecondToTimeval(duration_in_sec_), [loop]() { return loop->ExitLoop(); },
+ IOEventHighPriority)) {
return false;
}
}