summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2015-12-15 14:30:46 -0600
committerMark Salyzyn2015-12-15 16:24:04 -0600
commit1d9c7e728f826d82beff652478275c92c1e55f50 (patch)
treea075a385d0f82b859276166389b72bd4bf2d87fa /logd/LogListener.cpp
parent461a29540c01b44f07fc26ccb0d5bc7d0d92a974 (diff)
downloadplatform-system-core-1d9c7e728f826d82beff652478275c92c1e55f50.tar.gz
platform-system-core-1d9c7e728f826d82beff652478275c92c1e55f50.tar.xz
platform-system-core-1d9c7e728f826d82beff652478275c92c1e55f50.zip
logd: simpleperf inspired optimizations
memset is hot on log writes with too much overhead, not required. Bug: 24444530 Bug: 23685592 Change-Id: Ibe3c83abca6774fc79a3be461f2f1585f4a9b1ff
Diffstat (limited to 'logd/LogListener.cpp')
-rw-r--r--logd/LogListener.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index 9bbf9e84b..5348a2db6 100644
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -45,7 +45,6 @@ bool LogListener::onDataAvailable(SocketClient *cli) {
45 char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time) 45 char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time)
46 + LOGGER_ENTRY_MAX_PAYLOAD]; 46 + LOGGER_ENTRY_MAX_PAYLOAD];
47 struct iovec iov = { buffer, sizeof(buffer) }; 47 struct iovec iov = { buffer, sizeof(buffer) };
48 memset(buffer, 0, sizeof(buffer));
49 48
50 char control[CMSG_SPACE(sizeof(struct ucred))]; 49 char control[CMSG_SPACE(sizeof(struct ucred))];
51 struct msghdr hdr = { 50 struct msghdr hdr = {
@@ -60,6 +59,9 @@ bool LogListener::onDataAvailable(SocketClient *cli) {
60 59
61 int socket = cli->getSocket(); 60 int socket = cli->getSocket();
62 61
62 // To clear the entire buffer is secure/safe, but this contributes to 1.68%
63 // overhead under logging load. We are safe because we check counts.
64 // memset(buffer, 0, sizeof(buffer));
63 ssize_t n = recvmsg(socket, &hdr, 0); 65 ssize_t n = recvmsg(socket, &hdr, 0);
64 if (n <= (ssize_t)(sizeof(android_log_header_t))) { 66 if (n <= (ssize_t)(sizeof(android_log_header_t))) {
65 return false; 67 return false;