diff options
author | Mark Salyzyn <salyzyn@google.com> | 2015-06-04 13:35:30 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2015-06-05 10:20:55 -0700 |
commit | c1e9d6dada4fe20c0537c13cf3ff5a010d208ba1 (patch) | |
tree | 12f49bb34b85a86c9f6724c87ca4eb41d325eda2 /logd/LogBufferElement.cpp | |
parent | 5a9233444b519cb866cc657a4dce27c45f089a97 (diff) | |
download | system_core-c1e9d6dada4fe20c0537c13cf3ff5a010d208ba1.zip system_core-c1e9d6dada4fe20c0537c13cf3ff5a010d208ba1.tar.gz system_core-c1e9d6dada4fe20c0537c13cf3ff5a010d208ba1.tar.bz2 |
logd: filters remove leading expire messages and rate
(cherry pick from commit 047cc0729fd837a03b99db901941c1421ef15f96)
- 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
Diffstat (limited to 'logd/LogBufferElement.cpp')
-rw-r--r-- | logd/LogBufferElement.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/logd/LogBufferElement.cpp b/logd/LogBufferElement.cpp index 3d7237e..8238a52 100644 --- a/logd/LogBufferElement.cpp +++ b/logd/LogBufferElement.cpp @@ -104,8 +104,8 @@ char *android::tidToName(pid_t tid) { // assumption: mMsg == NULL size_t LogBufferElement::populateDroppedMessage(char *&buffer, LogBuffer *parent) { - static const char tag[] = "logd"; - static const char format_uid[] = "uid=%u%s too chatty%s, expire %u line%s"; + static const char tag[] = "chatty"; + static const char format_uid[] = "uid=%u%s%s expire %u line%s"; char *name = parent->uidToName(mUid); char *commName = android::tidToName(mTid); @@ -115,9 +115,15 @@ size_t LogBufferElement::populateDroppedMessage(char *&buffer, if (!commName) { commName = parent->pidToName(mPid); } - if (name && commName && !strcmp(name, commName)) { - free(commName); - commName = NULL; + size_t len = name ? strlen(name) : 0; + if (len && commName && !strncmp(name, commName, len)) { + if (commName[len] == '\0') { + free(commName); + commName = NULL; + } else { + free(name); + name = NULL; + } } if (name) { char *p = NULL; @@ -129,16 +135,16 @@ size_t LogBufferElement::populateDroppedMessage(char *&buffer, } if (commName) { char *p = NULL; - asprintf(&p, " comm=%s", commName); + asprintf(&p, " %s", commName); if (p) { free(commName); commName = p; } } // identical to below to calculate the buffer size required - size_t len = snprintf(NULL, 0, format_uid, mUid, name ? name : "", - commName ? commName : "", - mDropped, (mDropped > 1) ? "s" : ""); + len = snprintf(NULL, 0, format_uid, mUid, name ? name : "", + commName ? commName : "", + mDropped, (mDropped > 1) ? "s" : ""); size_t hdrLen; if (mLogId == LOG_ID_EVENTS) { |