Loading logd/LogBuffer.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -99,12 +99,20 @@ void LogBuffer::log(log_id_t log_id, struct timespec realtime, } // If we're using more than 256K of memory for log entries, prune // 10% of the log entries. // at least 10% of the log entries. // // mLogElementsLock must be held when this function is called. void LogBuffer::maybePrune(log_id_t id) { if (mSizes[id] > LOG_BUFFER_SIZE) { prune(id, mElements[id] / 10); unsigned long sizes = mSizes[id]; if (sizes > LOG_BUFFER_SIZE) { unsigned long sizeOver90Percent = sizes - ((LOG_BUFFER_SIZE * 9) / 10); unsigned long elements = mElements[id]; unsigned long pruneRows = elements * sizeOver90Percent / sizes; elements /= 10; if (pruneRows <= elements) { pruneRows = elements; } prune(id, pruneRows); } } Loading Loading
logd/LogBuffer.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -99,12 +99,20 @@ void LogBuffer::log(log_id_t log_id, struct timespec realtime, } // If we're using more than 256K of memory for log entries, prune // 10% of the log entries. // at least 10% of the log entries. // // mLogElementsLock must be held when this function is called. void LogBuffer::maybePrune(log_id_t id) { if (mSizes[id] > LOG_BUFFER_SIZE) { prune(id, mElements[id] / 10); unsigned long sizes = mSizes[id]; if (sizes > LOG_BUFFER_SIZE) { unsigned long sizeOver90Percent = sizes - ((LOG_BUFFER_SIZE * 9) / 10); unsigned long elements = mElements[id]; unsigned long pruneRows = elements * sizeOver90Percent / sizes; elements /= 10; if (pruneRows <= elements) { pruneRows = elements; } prune(id, pruneRows); } } Loading