Skip to content

Commit

Permalink
logd: pruning time horizon
Browse files Browse the repository at this point in the history
Estimate a time horizon of ten fold for worst UID pruning

Bug: 25453210
Bug: 24782000
Change-Id: I7118deb6d42531c68ed2ac2a59c57b0580b942cc
  • Loading branch information
Mark Salyzyn authored and The Android Automerger committed Nov 4, 2015
1 parent eb88db4 commit a611696
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion logd/LogBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,10 @@ void LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) {
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) {
Expand Down

0 comments on commit a611696

Please sign in to comment.