Log the time it takes netd to start up.
Currently on, bullhead-eng, I see:
01-21 14:59:26.174 21421 21421 I Netd : Netd started in 2432ms
Test: restarted netd and observed log message.
Bug: 32323979
Bug: 33279878
Change-Id: I7195d06d7ed1a09858185555f60b07e5bfe306ed
diff --git a/server/main.cpp b/server/main.cpp
index ae3a71a..aab15d6 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
+#include <math.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -40,6 +41,7 @@
#include "NetdConstants.h"
#include "NetdNativeService.h"
#include "NetlinkManager.h"
+#include "Stopwatch.h"
#include "DnsProxyListener.h"
#include "MDnsSdListener.h"
#include "FwmarkServer.h"
@@ -63,6 +65,7 @@
int main() {
using android::net::gCtls;
+ Stopwatch s;
ALOGI("Netd 1.0 starting");
remove_pid_file();
@@ -122,6 +125,8 @@
write_pid_file();
+ ALOGI("Netd started in %dms", static_cast<int>(s.timeTaken()));
+
IPCThreadState::self()->joinThreadPool();
ALOGI("Netd exiting");