summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHao Wang2017-12-04 00:10:40 -0600
committerliuchao2017-12-05 04:46:24 -0600
commitf6e229695375bda653a7f1b6f2470e054dc2d6bf (patch)
tree7c1a1e1f0facc2857425e6c81272cef15dd78de1 /logd/LogTimes.cpp
parentebca57adecb3521d78e4e1e5c220df897f84e336 (diff)
downloadplatform-system-core-f6e229695375bda653a7f1b6f2470e054dc2d6bf.tar.gz
platform-system-core-f6e229695375bda653a7f1b6f2470e054dc2d6bf.tar.xz
platform-system-core-f6e229695375bda653a7f1b6f2470e054dc2d6bf.zip
logd: enhance multiple blocking readers performance
logd suffers performance degradation when multiple blocking readers connect to it. Each time when the writer thread log new entries, all of the readers are notified regardless of which log id they are watching. In this case, only give notification to the readers who are actually watching new entries' log id. This decreases logd CPU consumption by skipping unnecessary LogBuffer::flushTo loops. Test: liblog-unit-tests, logd-unit-tests & CtsLiblogTestCases logcat-unit-tests Test: manual: 1.'logcat –b all' at constant heavy logging load level 2.simultaneously 'logcat –b crash' in another session, a healthy crash buffer usually keep empty 3.logd CPU consumption doesn't increase after step 2 Change-Id: I4ffc045c9feb7a0998f7e47ae2173f8f6aa28e8a
Diffstat (limited to 'logd/LogTimes.cpp')
-rwxr-xr-x[-rw-r--r--]logd/LogTimes.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index 25c2ad2b7..7a6f84b70 100644..100755
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -28,9 +28,8 @@
28pthread_mutex_t LogTimeEntry::timesLock = PTHREAD_MUTEX_INITIALIZER; 28pthread_mutex_t LogTimeEntry::timesLock = PTHREAD_MUTEX_INITIALIZER;
29 29
30LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client, 30LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client,
31 bool nonBlock, unsigned long tail, 31 bool nonBlock, unsigned long tail, log_mask_t logMask,
32 unsigned int logMask, pid_t pid, log_time start, 32 pid_t pid, log_time start, uint64_t timeout)
33 uint64_t timeout)
34 : mRefCount(1), 33 : mRefCount(1),
35 mRelease(false), 34 mRelease(false),
36 mError(false), 35 mError(false),