summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2015-09-30 09:40:09 -0500
committerMark Salyzyn2015-10-13 15:43:16 -0500
commit58b8be8906f903ac3d83c41bcb0fb9c7841945f0 (patch)
treed6651685f9087a946183bb657925e4e2485b060f /logd/LogStatistics.h
parent9b3a2784b94d88492906384ab3f3c9863f6b5eea (diff)
downloadplatform-system-core-58b8be8906f903ac3d83c41bcb0fb9c7841945f0.tar.gz
platform-system-core-58b8be8906f903ac3d83c41bcb0fb9c7841945f0.tar.xz
platform-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.h')
-rw-r--r--logd/LogStatistics.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h
index 8b90c53b5..6943820e3 100644
--- a/logd/LogStatistics.h
+++ b/logd/LogStatistics.h
@@ -374,6 +374,7 @@ struct TagEntry : public EntryBase {
374class LogStatistics { 374class LogStatistics {
375 size_t mSizes[LOG_ID_MAX]; 375 size_t mSizes[LOG_ID_MAX];
376 size_t mElements[LOG_ID_MAX]; 376 size_t mElements[LOG_ID_MAX];
377 size_t mDroppedElements[LOG_ID_MAX];
377 size_t mSizesTotal[LOG_ID_MAX]; 378 size_t mSizesTotal[LOG_ID_MAX];
378 size_t mElementsTotal[LOG_ID_MAX]; 379 size_t mElementsTotal[LOG_ID_MAX];
379 bool enable; 380 bool enable;
@@ -404,7 +405,11 @@ public:
404 // entry->setDropped(1) must follow this call 405 // entry->setDropped(1) must follow this call
405 void drop(LogBufferElement *entry); 406 void drop(LogBufferElement *entry);
406 // Correct for coalescing two entries referencing dropped content 407 // Correct for coalescing two entries referencing dropped content
407 void erase(LogBufferElement *e) { --mElements[e->getLogId()]; } 408 void erase(LogBufferElement *element) {
409 log_id_t log_id = element->getLogId();
410 --mElements[log_id];
411 --mDroppedElements[log_id];
412 }
408 413
409 std::unique_ptr<const UidEntry *[]> sort(size_t len, log_id id) { 414 std::unique_ptr<const UidEntry *[]> sort(size_t len, log_id id) {
410 return uidTable[id].sort(len); 415 return uidTable[id].sort(len);
@@ -413,6 +418,9 @@ public:
413 // fast track current value by id only 418 // fast track current value by id only
414 size_t sizes(log_id_t id) const { return mSizes[id]; } 419 size_t sizes(log_id_t id) const { return mSizes[id]; }
415 size_t elements(log_id_t id) const { return mElements[id]; } 420 size_t elements(log_id_t id) const { return mElements[id]; }
421 size_t realElements(log_id_t id) const {
422 return mElements[id] - mDroppedElements[id];
423 }
416 size_t sizesTotal(log_id_t id) const { return mSizesTotal[id]; } 424 size_t sizesTotal(log_id_t id) const { return mSizesTotal[id]; }
417 size_t elementsTotal(log_id_t id) const { return mElementsTotal[id]; } 425 size_t elementsTotal(log_id_t id) const { return mElementsTotal[id]; }
418 426