summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author mukesh agrawal <quiche@google.com> 2016-06-08 18:16:36 -0700
committer Mukesh Agrawal <quiche@google.com> 2016-06-28 22:20:00 +0000
commit2f1eb1c16d6061ba4f79ecf67d08827bf74bed27 (patch)
treeb45310ac6d6af45fb44f44cbc4dbf10f58cf4dc9
parent9c1f9bb7205e59d4bdc6f9e9601bc4b3ef210b3b (diff)
dumpsys: report per-service dump times
In WiFi soak testing, we've seen several cases where dumpsys times out. We've been unable to pin down the cause of the timeouts, as there's no single service that is obviously hung. Add reporting of service dump times, to help figure out why dumpsys is timing out. BUG=29090949 TEST=manual Manual test - load build on bullhead $ adb shell dumpsys | grep 'was the duration' - see non-zero values Change-Id: Iaba60d840ac55cba171a3ccbc74c2aee8b23dce6 (cherry picked from commit 4e4c548437b7cc7748e97ecc74a525e26a441cdb)
-rw-r--r--cmds/dumpsys/dumpsys.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp
index 7e5bbc578b..957a44912c 100644
--- a/cmds/dumpsys/dumpsys.cpp
+++ b/cmds/dumpsys/dumpsys.cpp
@@ -10,6 +10,7 @@
#include <thread>
#include <android-base/file.h>
+#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <binder/IServiceManager.h>
#include <binder/Parcel.h>
@@ -30,6 +31,7 @@
#include <unistd.h>
using namespace android;
+using android::base::StringPrintf;
using android::base::unique_fd;
using android::base::WriteFully;
@@ -210,7 +212,8 @@ int main(int argc, char* const argv[])
});
auto timeout = std::chrono::seconds(timeoutArg);
- auto end = std::chrono::steady_clock::now() + timeout;
+ auto start = std::chrono::steady_clock::now();
+ auto end = start + timeout;
struct pollfd pfd = {
.fd = local_end.get(),
@@ -267,6 +270,14 @@ int main(int argc, char* const argv[])
} else {
dump_thread.join();
}
+
+ if (N > 1) {
+ std::chrono::duration<double> elapsed_seconds =
+ std::chrono::steady_clock::now() - start;
+ aout << StringPrintf("------ %.3fs was the duration of '", elapsed_seconds.count()).
+ c_str();
+ aout << service_name << "' ------" << endl;
+ }
} else {
aerr << "Can't find service: " << service_name << endl;
}