summaryrefslogtreecommitdiffstats
path: root/logd/LogReader.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-11-30 11:35:56 -0800
committerMark Salyzyn <salyzyn@google.com>2015-12-07 14:24:02 -0800
commitb75cce0389748bea111ca62af623645117e12d9d (patch)
treeab909a5121db593408c82efe857c8c19e535ae64 /logd/LogReader.cpp
parent3ea02e8eca9fc0f2122d73a1d117292514256fcf (diff)
downloadsystem_core-b75cce0389748bea111ca62af623645117e12d9d.tar.gz
system_core-b75cce0389748bea111ca62af623645117e12d9d.tar.bz2
system_core-b75cce0389748bea111ca62af623645117e12d9d.zip
logd: wakeup on wrap or timeout
If a timeout is specified for the reader, then go to sleep with the socket open. If the start time is about to get pruned in the specified log buffers, then wakeup and dump the logs; or wakeup on timeout, whichever comes first. Bug: 25929746 Change-Id: I7d2421c2c5083b33747b84f74d9a560d3ba645df
Diffstat (limited to 'logd/LogReader.cpp')
-rw-r--r--logd/LogReader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
index 06135ddc0..c2d65b601 100644
--- a/logd/LogReader.cpp
+++ b/logd/LogReader.cpp
@@ -67,6 +67,14 @@ bool LogReader::onDataAvailable(SocketClient *cli) {
start.strptime(cp + sizeof(_start) - 1, "%s.%q");
}
+ uint64_t timeout = 0;
+ static const char _timeout[] = " timeout=";
+ cp = strstr(buffer, _timeout);
+ if (cp) {
+ timeout = atol(cp + sizeof(_timeout) - 1) * NS_PER_SEC +
+ log_time(CLOCK_REALTIME).nsec();
+ }
+
unsigned int logMask = -1;
static const char _logIds[] = " lids=";
cp = strstr(buffer, _logIds);
@@ -166,7 +174,7 @@ bool LogReader::onDataAvailable(SocketClient *cli) {
}
}
- FlushCommand command(*this, nonBlock, tail, logMask, pid, sequence);
+ FlushCommand command(*this, nonBlock, tail, logMask, pid, sequence, timeout);
command.runSocketCommand(cli);
return true;
}