summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-07-07 15:00:10 -0700
committerYabin Cui <yabinc@google.com>2016-07-07 23:06:06 +0000
commit6d1ee48b1260f5df933556ef4ec5c512c2b269ba (patch)
tree7b68e5787a6bd2548826962ba133a1ec6b761f86
parenta4f2c631cb8535347850bbfb56a98f846e964d76 (diff)
downloadextras-6d1ee48b1260f5df933556ef4ec5c512c2b269ba.tar.gz
simpleperf: don't warn if child process was killed by simpleperf.
Bug: 29574526 Change-Id: I3ae95ed95703bcd380ed086d3fbf7ae2830feed5
-rw-r--r--simpleperf/workload.cpp10
-rw-r--r--simpleperf/workload.h2
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_;