logd: filters remove leading expire messages and rate
- 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
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index ec67c07..68a0680 100644
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -31,6 +31,7 @@
mRelease(false),
mError(false),
threadRunning(false),
+ leadingDropped(false),
mReader(reader),
mLogMask(logMask),
mPid(pid),
@@ -123,6 +124,8 @@
bool privileged = FlushCommand::hasReadLogs(client);
+ me->leadingDropped = true;
+
lock();
while (me->threadRunning && !me->isError_Locked()) {
@@ -132,6 +135,7 @@
if (me->mTail) {
logbuf.flushTo(client, start, privileged, FilterFirstPass, me);
+ me->leadingDropped = true;
}
start = logbuf.flushTo(client, start, privileged, FilterSecondPass, me);
@@ -163,6 +167,14 @@
LogTimeEntry::lock();
+ if (me->leadingDropped) {
+ if (element->getDropped()) {
+ LogTimeEntry::unlock();
+ return false;
+ }
+ me->leadingDropped = false;
+ }
+
if (me->mCount == 0) {
me->mStart = element->getSequence();
}
@@ -190,6 +202,13 @@
goto skip;
}
+ if (me->leadingDropped) {
+ if (element->getDropped()) {
+ goto skip;
+ }
+ me->leadingDropped = false;
+ }
+
// Truncate to close race between first and second pass
if (me->mNonBlock && me->mTail && (me->mIndex >= me->mCount)) {
goto stop;