logd: Add minimum time bucket statistics
* Only enabled for dev builds because halves performance.
- Used to establish if /proc/sys/net/unix/max_dgram_qlen
is appropriate for the platform
(see logd/LogStatistics.cpp comments)
- enabled if logd.dgram_qlen.statistics is not zero/empty
Change-Id: Ib8ecfeb75b6f0f954c099a6b1032b8afb5efcbd4
diff --git a/logd/main.cpp b/logd/main.cpp
index 6216b95..8792d32 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -24,9 +24,12 @@
#include <sys/capability.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
#include <linux/prctl.h>
+#include <cutils/properties.h>
+
#include "private/android_filesystem_config.h"
#include "CommandListener.h"
#include "LogBuffer.h"
@@ -92,6 +95,12 @@
LogBuffer *logBuf = new LogBuffer(times);
+ char dgram_qlen_statistics[PROPERTY_VALUE_MAX];
+ property_get("logd.dgram_qlen.statistics", dgram_qlen_statistics, "");
+ if (atol(dgram_qlen_statistics)) {
+ logBuf->enableDgramQlenStatistics();
+ }
+
// LogReader listens on /dev/socket/logdr. When a client
// connects, log entries in the LogBuffer are written to the client.