summaryrefslogtreecommitdiffstats
path: root/logd
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2018-04-04 14:35:34 -0700
committerJoe Onorato <joeo@google.com>2018-04-04 14:46:45 -0700
commit4bba6982455de327bdf018c386032277a08860d5 (patch)
treea01ec17a9035e02b97e2d50a4d5414603bd904c3 /logd
parente9aaadfb2b26df361411f973d154b3bac45572fb (diff)
downloadsystem_core-4bba6982455de327bdf018c386032277a08860d5.tar.gz
system_core-4bba6982455de327bdf018c386032277a08860d5.tar.bz2
system_core-4bba6982455de327bdf018c386032277a08860d5.zip
Make logd more aggressive when scanning for the position from which to resume logging.
Events in the LogBuffer are supposed to be sorted by timestamp, but for a variety of reasons that doesn't always happen. When a LogReader is reading from LogBuffer, LogBuffer starts at the newest event, and scans backward through the list, looking for the last event. Previously it would accept a couple that were a little bit out of order, but if it found one that was ancient, it would just bail. This change removes that check for the ancient messages. They are probably indicative of something else upstream, but since there is no invariant of the list being sorted, this change simplifies the search algorithm, and makes it look only at the previous 300 events. Bug: 77222120 Test: while true ; do frameworks/base/cmds/statsd/run_tests.sh 2h ; done Change-Id: I0824ee7590d34056ce27233a87cd7802c28f50e4
Diffstat (limited to 'logd')
-rw-r--r--logd/LogBuffer.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index a78319ff4..9b0436367 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -1115,9 +1115,6 @@ log_time LogBuffer::flushTo(SocketClient* reader, const log_time& start,
// client wants to start from the beginning
it = mLogElements.begin();
} else {
- // 3 second limit to continue search for out-of-order entries.
- log_time min = start - pruneMargin;
-
// Cap to 300 iterations we look back for out-of-order entries.
size_t count = 300;
@@ -1133,7 +1130,7 @@ log_time LogBuffer::flushTo(SocketClient* reader, const log_time& start,
} else if (element->getRealTime() == start) {
last = ++it;
break;
- } else if (!--count || (element->getRealTime() < min)) {
+ } else if (!--count) {
break;
}
}