Merge "logd: pruning time horizon" am: 183df3ddf7 am: 83f1cd2ae4
am: 52aa4244ca
* commit '52aa4244ca784dd0bc6ebc0511db05b03eff782d':
logd: pruning time horizon
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index 1de8e64..4ada788 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -436,7 +436,10 @@
worst_sizes = sorted[0]->getSizes();
// Calculate threshold as 12.5% of available storage
size_t threshold = log_buffer_size(id) / 8;
- if (worst_sizes > threshold) {
+ if ((worst_sizes > threshold)
+ // Allow time horizon to extend roughly tenfold, assume
+ // average entry length is 100 characters.
+ && (worst_sizes > (10 * sorted[0]->getDropped()))) {
worst = sorted[0]->getKey();
second_worst_sizes = sorted[1]->getSizes();
if (second_worst_sizes < threshold) {