diff options
author | Yabin Cui <yabinc@google.com> | 2016-07-07 23:06:32 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-07-07 23:06:32 +0000 |
commit | e26676ef00a5f0c6ea547ba613fe8f06c869d605 (patch) | |
tree | 3e2f20500c5a5cbb86cceae2ac83a02b96851f82 | |
parent | 57dac93cf3ecb233ddc21b6d6e09cbf6806bcd5e (diff) | |
parent | 6d1ee48b1260f5df933556ef4ec5c512c2b269ba (diff) | |
download | extras-e26676ef00a5f0c6ea547ba613fe8f06c869d605.tar.gz |
Merge "simpleperf: don't warn if child process was killed by simpleperf."
-rw-r--r-- | simpleperf/workload.cpp | 10 | ||||
-rw-r--r-- | simpleperf/workload.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/simpleperf/workload.cpp b/simpleperf/workload.cpp index 35617fd3..b67fa8fd 100644 --- a/simpleperf/workload.cpp +++ b/simpleperf/workload.cpp @@ -33,9 +33,9 @@ std::unique_ptr<Workload> Workload::CreateWorkload(const std::vector<std::string Workload::~Workload() { if (work_pid_ != -1 && work_state_ != NotYetCreateNewProcess) { - if (!Workload::WaitChildProcess(false)) { + if (!Workload::WaitChildProcess(false, false)) { kill(work_pid_, SIGKILL); - Workload::WaitChildProcess(true); + Workload::WaitChildProcess(true, true); } } if (start_signal_fd_ != -1) { @@ -137,14 +137,16 @@ bool Workload::Start() { return true; } -bool Workload::WaitChildProcess(bool wait_forever) { +bool Workload::WaitChildProcess(bool wait_forever, bool is_child_killed) { bool finished = false; int status; pid_t result = TEMP_FAILURE_RETRY(waitpid(work_pid_, &status, (wait_forever ? 0 : WNOHANG))); if (result == work_pid_) { finished = true; if (WIFSIGNALED(status)) { - LOG(WARNING) << "child process was terminated by signal " << strsignal(WTERMSIG(status)); + if (!(is_child_killed && WTERMSIG(status) == SIGKILL)) { + LOG(WARNING) << "child process was terminated by signal " << strsignal(WTERMSIG(status)); + } } else if (WIFEXITED(status) && WEXITSTATUS(status) != 0) { LOG(WARNING) << "child process exited with exit code " << WEXITSTATUS(status); } diff --git a/simpleperf/workload.h b/simpleperf/workload.h index 60b9ee8d..1407c767 100644 --- a/simpleperf/workload.h +++ b/simpleperf/workload.h @@ -52,7 +52,7 @@ class Workload { } bool CreateNewProcess(); - bool WaitChildProcess(bool wait_forever); + bool WaitChildProcess(bool wait_forever, bool is_child_killed); WorkState work_state_; std::vector<std::string> args_; |