History log of /system/core/logd/LogReader.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3c501b50b41086cde59a6811f4aa5cd3e736f5f2 18-Apr-2017 Mark Salyzyn <salyzyn@google.com> logd: reader/writer element locks

Switch to a reader writer lock for the Element List lock. Also setup
for a reader writer lock for the Times list, but continue to use a
mutex where rdlock() and wrlock() are the same implementation for now.

This should improve general reader performance and prevent blocking of
other reader operations or exit by a single hung logd.reader.per
thread. For example, a full length logcat of an empty buffer (eg:
crash log buffer) will hold a lock while the iterator scans the entire
list.

Test: gTest liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Bug: 37378309
Bug: 37483775
Change-Id: If5723ff4a978e17d828a75321e8f0ba91d4a09e0
/system/core/logd/LogReader.cpp
fa3add33644eb0e0335fefafef41de5e2d3c0b3c 29-Dec-2016 Mark Salyzyn <salyzyn@google.com> logd: report log reader instantiation

Helpful instrumentation to determine who is waiting for logger data.

Test: manual
Bug: 37274132
Bug: 37378309
Change-Id: I14fb1d9d15ae413930121048b770852359f06682
/system/core/logd/LogReader.cpp
ae2abf112ca8555dfc09eb1fc4b8bd637e4bc7cc 31-Mar-2017 Mark Salyzyn <salyzyn@google.com> logd: correctly label identical lines

Move lastTid array from local in LogBuffer::flushTo to per-reader
context in LogTimes::mLastTid and pass into LogBuffer::flushTo.

Replace NULL with nullptr in touched files.

Simplify LogTimeEntry::cleanSkip_Locked initialization of skipAhead
to memset, to match mLastTid memset initialization.

Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
Test: adb logcat -b all | grep chatty | grep -v identical
Bug: 36488201
Change-Id: I0c3887f220a57f80c0490be4b182657b9563aa3f
/system/core/logd/LogReader.cpp
5a34d6ea43d28f3b5d27bf6dd5b9fa31ec033531 10-Mar-2017 Mark Salyzyn <salyzyn@google.com> logd: drop mSequence from LogBufferElement

Use getRealTime() instead and leverage private liblog log_time
comparison and math functions. This saves 8 bytes off each
element in the logging database.

Test: gTest liblog-unit-tests logd-unit-tests logcat-unit-tests
Bug: 35373582
Change-Id: Ia55ef8b95cbb2a841ccb1dae9a24f314735b076a
/system/core/logd/LogReader.cpp
501c373916e292764400dbae735f44b33378400f 10-Mar-2017 Mark Salyzyn <salyzyn@google.com> logd: specify clang format

Switch _all_ file's coding style to match to ease all future changes.

SideEffects: None
Test: compile
Bug: 35373582
Change-Id: I470cb17f64fa48f14aafc02f574e296bffe3a3f3
/system/core/logd/LogReader.cpp
0eeb06b932f185e10377e4494475d2cdd6adfa1b 02-Dec-2016 Mark Salyzyn <salyzyn@google.com> utils: Add FastStrcmp.h

Move existing fast<str*cmp> templates for general use, pulled from
the implementation used in logd that dealt with speed through cache
locality and subroutine call mitigation. Rename to fastcmp.

Test: logd-benchmarks and based on manual profiling from the past
Bug: 31456426
Change-Id: Ic62f4a437fc3e06ffdeaae73a6f34e197957a6b0
/system/core/logd/LogReader.cpp
aeaaf81c2cc8366ac4f66eb3d2fc85f9b8194982 30-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: logd: logcat: Split out log/logger.h into public and private.

log/logger.h pieces moved into log/log.h. Correct for some
minor Android Coding standards.

Test: gTests liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I0a19fd8788eec20a582e72e4c62c04534bdb1b9a
/system/core/logd/LogReader.cpp
5c77ad55d0cdee84cd45fd5d0d066f3c61d76ce6 23-Feb-2016 Mark Salyzyn <salyzyn@google.com> logd: sock_alloc_send_pskb starves pruning

Allow socket send syscall to terminate after 32 seconds if reader
stalled because of memory pressure allocating new network buffers

Add a gTest to catch regressions, add security buffer to log_dump

Bug: 27242723
Change-Id: Idaa6699d9d284e7f5f723ae0e76b3d6aa3371489
/system/core/logd/LogReader.cpp
2ad0bd0a9b594bbe2560b405b0008b7bc742cfca 23-Feb-2016 Mark Salyzyn <salyzyn@google.com> logd: Allow (some) headers to be individually importable

LogReader.h needs to be individually importable.

Fix a few others, drop includes of local includes, let them be
included in source instead and allow headers to be included
alphabetically. Was not a complete audit since goal was to
separate LogReader.h out from the pack.

Bug: 27242723
Change-Id: Ic7759ef90995e5bd285810706af33550c73cf5b5
/system/core/logd/LogReader.cpp
8fa8896d2ed97eb274c62f0e386dabf2e2a82a45 26-Jan-2016 Mark Salyzyn <salyzyn@google.com> logd: security buffer only AID_SYSTEM reader

- limit AID_SYSTEM uid or gid to read security buffer messages
- adjust liblog tests to reflect the reality of this adjustment

To fully test all security buffer paths and modes

$ su 0,0,0 /data/nativetest/liblog-unit-tests/liblog-unit-tests --gtest_filter=liblog.__security*
$ su 1000,1000,1000 /data/nativetest/liblog-unit-tests/liblog-unit-tests --gtest_filter=liblog.__security*
$ su 2000,2000,2000 /data/nativetest/liblog-unit-tests/liblog-unit-tests --gtest_filter=liblog.__security*

ToDo: Integrate the above individually into the gTest Q/A testing

Bug: 26029733
Change-Id: Idcf5492db78fa6934ef6fb43f3ef861052675651
/system/core/logd/LogReader.cpp
b75cce0389748bea111ca62af623645117e12d9d 30-Nov-2015 Mark Salyzyn <salyzyn@google.com> logd: wakeup on wrap or timeout

If a timeout is specified for the reader, then go to sleep
with the socket open. If the start time is about to get
pruned in the specified log buffers, then wakeup and dump
the logs; or wakeup on timeout, whichever comes first.

Bug: 25929746
Change-Id: I7d2421c2c5083b33747b84f74d9a560d3ba645df
/system/core/logd/LogReader.cpp
b6bee33182cedea49199eb2252b3f3b442899c6d 08-Sep-2015 Mark Salyzyn <salyzyn@google.com> liblog: logd: support logd.timestamp = monotonic

if ro.logd.timestamp or persist.logd.timestamp are set to the value
monotonic then liblog writer, liblog printing and logd all switch to
recording/printing monotonic time rather than realtime. If reinit
detects a change for presist.logd.timestamp, correct the older entry
timestamps in place.

ToDo: A corner case condition where new log entries in monotonic time
occur before logd reinit detects persist.logd.timestamp, there
will be a few out-of-order entries, but with accurate
timestamps. This problem does not happen for ro.logd.timestamp
as it is set before logd starts.

NB: This offers a nano second time accuracy on all log entries
that may be more suitable for merging with other system
activities, such as systrace, that also use monotonic time. This
feature is for debugging.

Bug: 23668800
Change-Id: Iee6dab7140061b1a6627254921411f61b01aa5c2
/system/core/logd/LogReader.cpp
ddda212faa81d62f637926680cd8163345120f71 02-Oct-2015 Mark Salyzyn <salyzyn@google.com> 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
/system/core/logd/LogReader.cpp
7718778793b106498b931dd708a466cf3a6f6a0f 13-May-2015 Mark Salyzyn <salyzyn@google.com> logd: Cleanup

- Android Coding Standard for Constructors
- Side effects NONE

Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
/system/core/logd/LogReader.cpp
e3aeeeeccc260c29ca5907a444f8d746bcc2f8a5 17-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: syscall optimization

- prset(PR_SET_NAME) call once
- No need to call getuid(), should be AID_LOGD

Change-Id: I4dde0b178bc84e711b355cd7677b0dbf905a0634
/system/core/logd/LogReader.cpp
f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c 03-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: replace internal CLOCK_MONOTONIC use with sequence numbers

- switch to simpler and faster internal sequence number, drops
a syscall overhead on 32-bit platforms.
- add ability to break-out of flushTo loop with filter return -1
allowing in reduction in reader overhead.

Change-Id: Ic5cb2b9afa4d9470153971fc9197b07279e2b79d
/system/core/logd/LogReader.cpp
f669acb01880216b6c1d29fc226f2c3ec3a6368a 16-Sep-2014 Mark Salyzyn <salyzyn@google.com> logd: in nonblocking read, sched_yield() synchronization

- sched_yield and lock synchronization in reader thread
startup to give writer thread a chance to catch up

Bug: 17512203
Change-Id: I43cf0b4e2829b22b3ab4e537fa95ce13c76a869c
/system/core/logd/LogReader.cpp
8daa9af02dc0e63ce220e3fa95bf5fe4d6b7a99a 28-Apr-2014 Mark Salyzyn <salyzyn@google.com> logd: add thread setname

- permits easier determination of logd thread at
fault in a stack trace from debuggerd.

Bug: 14275676
Change-Id: Iac2c523147e2bcce34ab7ddcecd02582c5fa7cc0
/system/core/logd/LogReader.cpp
dfc47e86858ea67c72f1df2fdb97094b8e8248f2 24-Mar-2014 Mark Salyzyn <salyzyn@google.com> logd: libsysutils: logd startup outside init environment

Change-Id: I3426b6c3eebdd0c8258e966dcaaaa2825d7a23d1
/system/core/logd/LogReader.cpp
a1c60cf80d0d1002576a6cf8aa395b295c6a272e 19-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: Find log time for arbitrary time to tail

- prototype to evaluate the increase in complexity or
performance impact.

Change-Id: I4e815d74c023092fbb75055d260f75de57ad6522
/system/core/logd/LogReader.cpp
fa3716b2501ccddc8e0cd30f6343692b8deb7639 15-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: liblog: logcat: Arbitrary time to tail

Change-Id: I10e8d92c933e31ee11e78d2d1114261a30c4be0e
/system/core/logd/LogReader.cpp
0175b0747a1f55329109e84c9a1322dcb95e2848 26-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: initial checkin.

* Create a new userspace log daemon for handling logging messages.

Original-Change-Id: I75267df16359684490121e6c31cca48614d79856
Signed-off-by: Nick Kralevich <nnk@google.com>

* Merge conflicts
* rename new syslog daemon to logd to prevent confusion with bionic syslog
* replace racy getGroups call with KISS call to client->getGid()
* Timestamps are filed at logging source
* insert entries into list in timestamp order
* Added LogTimeEntry tail filtration handling
* Added region locking around LogWriter list
* separate threads for each writer
* /dev/socket/logd* permissions

Signed-off-by: Mark Salyzyn <salyzyn@google.com>

(cherry picked from commit 3e76e0a49760c4970b7cda6153e51026af98e4f3)

Author: Nick Kralevich <nnk@google.com>
Change-Id: Ice88b1412d8f9daa7f9119b2b5aaf684a5e28098
/system/core/logd/LogReader.cpp