summaryrefslogtreecommitdiffstats
path: root/logd/LogKlog.cpp
diff options
context:
space:
mode:
authorHao Wang <wanghao48@huawei.com>2017-12-04 14:10:40 +0800
committerliuchao <liuchao741@huawei.com>2017-12-05 18:46:24 +0800
commitf6e229695375bda653a7f1b6f2470e054dc2d6bf (patch)
tree7c1a1e1f0facc2857425e6c81272cef15dd78de1 /logd/LogKlog.cpp
parentebca57adecb3521d78e4e1e5c220df897f84e336 (diff)
downloadsystem_core-f6e229695375bda653a7f1b6f2470e054dc2d6bf.tar.gz
system_core-f6e229695375bda653a7f1b6f2470e054dc2d6bf.tar.bz2
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/LogKlog.cpp')
-rwxr-xr-x[-rw-r--r--]logd/LogKlog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
index a7e72087f..7a7ac7da8 100644..100755
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -826,7 +826,7 @@ int LogKlog::log(const char* buf, ssize_t len) {
// notify readers
if (!rc) {
- reader->notifyNewLog();
+ reader->notifyNewLog(static_cast<log_mask_t>(1 << LOG_ID_KERNEL));
}
return rc;