combine wait for exec log with service exit log
- allows easier tracking of wait time from monitoring tools
- this change also reduces unnecessary log spam
- service exit log looks like this:
init: Service 'exec 4 (/system/bin/otapreopt_slot)' (pid 611) exited with status 0 waiting took 0.060771 seconds
bug: 37752410
Test: reboot and check log
(cherry picked from commit 4de31e1481
)
Change-Id: Icb83a6a23b45ebd9b4c9d86ee37df8ee3d6e790a
This commit is contained in:
parent
49f9b4c0d0
commit
6e53199191
1 changed files with 9 additions and 9 deletions
|
@ -275,10 +275,6 @@ void Service::Reap() {
|
|||
std::for_each(descriptors_.begin(), descriptors_.end(),
|
||||
std::bind(&DescriptorInfo::Clean, std::placeholders::_1));
|
||||
|
||||
if (flags_ & SVC_EXEC) {
|
||||
LOG(INFO) << "SVC_EXEC pid " << pid_ << " finished...";
|
||||
}
|
||||
|
||||
if (flags_ & SVC_TEMPORARY) {
|
||||
return;
|
||||
}
|
||||
|
@ -1056,21 +1052,26 @@ bool ServiceManager::ReapOneProcess() {
|
|||
Service* svc = FindServiceByPid(pid);
|
||||
|
||||
std::string name;
|
||||
std::string wait_string;
|
||||
if (svc) {
|
||||
name = android::base::StringPrintf("Service '%s' (pid %d)",
|
||||
svc->name().c_str(), pid);
|
||||
if (svc->flags() & SVC_EXEC) {
|
||||
wait_string =
|
||||
android::base::StringPrintf(" waiting took %f seconds", exec_waiter_->duration_s());
|
||||
}
|
||||
} else {
|
||||
name = android::base::StringPrintf("Untracked pid %d", pid);
|
||||
}
|
||||
|
||||
if (WIFEXITED(status)) {
|
||||
LOG(INFO) << name << " exited with status " << WEXITSTATUS(status);
|
||||
LOG(INFO) << name << " exited with status " << WEXITSTATUS(status) << wait_string;
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
LOG(INFO) << name << " killed by signal " << WTERMSIG(status);
|
||||
LOG(INFO) << name << " killed by signal " << WTERMSIG(status) << wait_string;
|
||||
} else if (WIFSTOPPED(status)) {
|
||||
LOG(INFO) << name << " stopped by signal " << WSTOPSIG(status);
|
||||
LOG(INFO) << name << " stopped by signal " << WSTOPSIG(status) << wait_string;
|
||||
} else {
|
||||
LOG(INFO) << name << " state changed";
|
||||
LOG(INFO) << name << " state changed" << wait_string;
|
||||
}
|
||||
|
||||
if (!svc) {
|
||||
|
@ -1080,7 +1081,6 @@ bool ServiceManager::ReapOneProcess() {
|
|||
svc->Reap();
|
||||
|
||||
if (svc->flags() & SVC_EXEC) {
|
||||
LOG(INFO) << "Wait for exec took " << *exec_waiter_;
|
||||
exec_waiter_.reset();
|
||||
}
|
||||
if (svc->flags() & SVC_TEMPORARY) {
|
||||
|
|
Loading…
Reference in a new issue