summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2015-10-02 11:22:52 -0500
committerMark Salyzyn2015-10-02 18:45:22 -0500
commitddda212faa81d62f637926680cd8163345120f71 (patch)
tree73f729e24adb87f184691d0014cf377b398a6a64 /logd/LogReader.cpp
parent5ac5c6b19364b5b3061a59db796b2357c95c3b64 (diff)
downloadplatform-system-core-ddda212faa81d62f637926680cd8163345120f71.tar.gz
platform-system-core-ddda212faa81d62f637926680cd8163345120f71.tar.xz
platform-system-core-ddda212faa81d62f637926680cd8163345120f71.zip
logd: optimize code hotspots
Discovered that we had a few libc hotspots. Adjust code to generally reduce or nullify the number of calls to malloc, free, strlen, strcmp, strncmp, memcmp & strncasecmp. Total gain looks to be about 3% of logd's processing time. malloc still contributes to 3%, but all others are now total 0.5%. Bug: 23685592 Change-Id: Ife721121667969260cdb8b055524ae90f5911278
Diffstat (limited to 'logd/LogReader.cpp')
-rw-r--r--logd/LogReader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
index c7deec0d6..383384389 100644
--- a/logd/LogReader.cpp
+++ b/logd/LogReader.cpp
@@ -95,7 +95,7 @@ bool LogReader::onDataAvailable(SocketClient *cli) {
95 } 95 }
96 96
97 bool nonBlock = false; 97 bool nonBlock = false;
98 if (strncmp(buffer, "dumpAndClose", 12) == 0) { 98 if (!fast<strncmp>(buffer, "dumpAndClose", 12)) {
99 // Allow writer to get some cycles, and wait for pending notifications 99 // Allow writer to get some cycles, and wait for pending notifications
100 sched_yield(); 100 sched_yield();
101 LogTimeEntry::lock(); 101 LogTimeEntry::lock();