summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Remove execute bit for source filesYi Kong2018-07-131-0/+0
| | | | | Test: ls -l Change-Id: Id09514a03f82c89e6350a5f9e34b9ef8bfe27b7e
* logd: enhance multiple blocking readers performanceHao Wang2017-12-051-3/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* logd: reader/writer element locksMark Salyzyn2017-04-201-5/+5
| | | | | | | | | | | | | | | | | 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
* logd: correctly label identical linesMark Salyzyn2017-03-311-11/+11
| | | | | | | | | | | | | | | 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
* logd: drop mSequence from LogBufferElementMark Salyzyn2017-03-161-6/+8
| | | | | | | | | | 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
* logd: specify clang formatMark Salyzyn2017-03-131-44/+44
| | | | | | | | | Switch _all_ file's coding style to match to ease all future changes. SideEffects: None Test: compile Bug: 35373582 Change-Id: I470cb17f64fa48f14aafc02f574e296bffe3a3f3
* logd: clarify release_Locked() for static analyzerMark Salyzyn2016-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | (cherry pick from commit 0ecdec7a0922f5e99569c558fd3c6440b826e583) release_Locked() is called with a reference count and threadRunning, the static analyzer can not tell this and estimates that a call to delete this will occur. So let us invent a new call release_nodelete_Locked() to ensure it is clear we will not be arranging a delete this in the context of this code path. The delete this will follow in the immediate codepath in this function after threadRunning is cleared, and decRef_Locked() is called. Change will also remove any developer FUD regarding release_Locked() usage at this location. SideEffects: None Bug: 27434831 Change-Id: I91b060b2dadc72cc449fa381c934afb577bee037
* logd: security buffer only AID_SYSTEM readerMark Salyzyn2016-02-011-2/+3
| | | | | | | | | | | | | | | | - 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
* logd: wakeup on wrap or timeoutMark Salyzyn2015-12-071-2/+20
| | | | | | | | | | 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
* logd: update region lock after entry has passed to reader socketMark Salyzyn2015-10-071-2/+5
| | | | | | | | | - The reader region level indicates the location to protect, but once it has been passed to the calling reader, then allow us to go one beyond so that a clear or prune thread can remove the entry. Bug: 23711431 Change-Id: I0f2389858dd8c83366c034360f67d7c363625b56
* logd: filters remove leading expire messages and rateMark Salyzyn2015-06-051-0/+19
| | | | | | | | | | | | | | | | | - Cleanup resulting from experience and feedback - When filtering inside logd, drop any leading expire messages, they are cluttering up leading edge of tombstones (which filter by pid) - Increase and introduce EXPIRE_RATELIMIT from 1 to 10 seconds - Increase EXPIRE_THRESHOLD from 4 to 10 count - Improve the expire messages from: logd : uid=1000(system) too chatty comm=com.google.android.phone, expire 2800 lines change tag to be more descriptive, and reduce accusatory tone to: chatty : uid=1000(system) com.google.android.phone expire 2800 lines - if the UID name forms a prefix for comm name, then drop UID name Change-Id: Ied7cc04c0ab3ae02167649a0b97378e44ef7b588
* logd: CleanupMark Salyzyn2015-05-121-18/+17
| | | | | | | - Android Coding Standard for Constructors - Side effects NONE Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
* logd: replace internal CLOCK_MONOTONIC use with sequence numbersMark Salyzyn2015-03-181-11/+13
| | | | | | | | | - 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
* logd: Fix pruningTraianX Schiau2015-01-141-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a scenario in which an on-line (blocking) client is running and a clean is attempted (logcat -c), the following can be observed: 1) the on-line logger seems to freeze 2) any other clear attempt will have no effect What is actually happening: In this case prune function will "instruct" the oldest timeEntry to skip a huge number (very close to ULONG_MAX) of messages, this being the cause of 1. Since the consumer thread will skip all the log entries, mStart updating will also be skipped. So a new cleaning attempt will have the same oldest entry, nothing will be done. Fix description: a. keep a separated skipAhead count for individual log buffers (log_id_t) LogTimeEntry::LogTimeEntry LogTimeEntry::FilterSecondPass LogTimeEntry::skipAhead LogTimeEntry::riggerSkip_Locked b. update LogTimeEntry::mStart even if the current message is skipped LogTimeEntry::FilterSecondPass c. while pruning, only take into account the LogTimeEntrys that are monitoring the log_id in question, and provide a public method of checking this. LogTimeEntry::isWatching LogTimeEntry::FilterFirstPass LogTimeEntry::FilterSecondPass d. Reset the skip cont befor the client thtread starts to sleep, at this point we should be up to date. LogTimeEntry::cleanSkip_Locked LogTimeEntry::threadStart Change-Id: I1b369dc5b02476e633e52578266a644e37e188a5 Signed-off-by: TraianX Schiau <traianx.schiau@intel.com>
* logd: persistent reader threadsMark Salyzyn2014-08-121-18/+11
| | | | | | | (cherry picked from commit c113c5813ebd620e0bc60ece9a32ea14c08ea237) Bug: 16822776 Change-Id: I5bea468a41089b51108880044f32e2b2df1278e7
* logd: logcat unexpected EOF on slow consolesMark Salyzyn2014-06-061-0/+1
| | | | Change-Id: I3520aa05e080de85df352ef36ae16e0406311f3c
* logd: add thread setnameMark Salyzyn2014-04-281-0/+4
| | | | | | | - permits easier determination of logd thread at fault in a stack trace from debuggerd. Bug: 14275676 Change-Id: Iac2c523147e2bcce34ab7ddcecd02582c5fa7cc0
* logd: transitory reader thread create should be detachedMark Salyzyn2014-04-041-5/+16
| | | | | Bug: 13692914 Change-Id: Ia7306e6e844ae9f17c6f594bf6b25f3148652570
* logd: liblog: logcat: Arbitrary time to tailMark Salyzyn2014-03-141-2/+3
| | | | Change-Id: I10e8d92c933e31ee11e78d2d1114261a30c4be0e
* logd: Adjust to match defacto coding styleMark Salyzyn2014-02-261-1/+1
| | | | | | (cherry picked from commit c46f77bd2ad01f3a695416c4cf22d6a9738bb7b8) Change-Id: I80685cdc7116e10c5a5a77abe856fd96804f9117
* logd: initial checkin.Mark Salyzyn2014-02-261-0/+225
* 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