summaryrefslogtreecommitdiffstats
path: root/logd/LogStatistics.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-09-30 07:40:09 -0700
committerMark Salyzyn <salyzyn@google.com>2015-10-13 13:43:16 -0700
commit58b8be8906f903ac3d83c41bcb0fb9c7841945f0 (patch)
treed6651685f9087a946183bb657925e4e2485b060f /logd/LogStatistics.cpp
parent9b3a2784b94d88492906384ab3f3c9863f6b5eea (diff)
downloadsystem_core-58b8be8906f903ac3d83c41bcb0fb9c7841945f0.tar.gz
system_core-58b8be8906f903ac3d83c41bcb0fb9c7841945f0.tar.bz2
system_core-58b8be8906f903ac3d83c41bcb0fb9c7841945f0.zip
logd: correct for number of elements in prune
Chatty logs would distort the average log size by elevating the elements, but not the size. Add statistical collection for the number of elements that report chatty, and subtract that from the number of elements to improve the pruning estimate. Pick minElements as 1% rather than 10% of the total with this more accurate number of elements, to a minumum of 4. Bug: 24511000 Change-Id: I3f36558138aa0b2a50e4fac6440c3a8505d95276
Diffstat (limited to 'logd/LogStatistics.cpp')
-rw-r--r--logd/LogStatistics.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index c3b10ad36..fdb2576d6 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -27,6 +27,7 @@ LogStatistics::LogStatistics() : enable(false) {
log_id_for_each(id) {
mSizes[id] = 0;
mElements[id] = 0;
+ mDroppedElements[id] = 0;
mSizesTotal[id] = 0;
mElementsTotal[id] = 0;
}
@@ -93,6 +94,9 @@ void LogStatistics::subtract(LogBufferElement *element) {
unsigned short size = element->getMsgLen();
mSizes[log_id] -= size;
--mElements[log_id];
+ if (element->getDropped()) {
+ --mDroppedElements[log_id];
+ }
if (log_id == LOG_ID_KERNEL) {
return;
@@ -119,6 +123,7 @@ void LogStatistics::drop(LogBufferElement *element) {
log_id_t log_id = element->getLogId();
unsigned short size = element->getMsgLen();
mSizes[log_id] -= size;
+ ++mDroppedElements[log_id];
uidTable[log_id].drop(element->getUid(), element);