summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2017-03-10 10:44:14 -0600
committerMark Salyzyn2017-03-16 10:22:00 -0500
commit5a34d6ea43d28f3b5d27bf6dd5b9fa31ec033531 (patch)
tree528482f492c2a13a1079e737a510ca6e5fbb70c9 /logd/LogTimes.cpp
parent1d84f0b2afd36c4a6a367761c3d518789a424419 (diff)
downloadplatform-system-core-5a34d6ea43d28f3b5d27bf6dd5b9fa31ec033531.tar.gz
platform-system-core-5a34d6ea43d28f3b5d27bf6dd5b9fa31ec033531.tar.xz
platform-system-core-5a34d6ea43d28f3b5d27bf6dd5b9fa31ec033531.zip
logd: drop mSequence from LogBufferElement
Use getRealTime() instead and leverage private liblog log_time comparison and math functions. This saves 8 bytes off each element in the logging database. Test: gTest liblog-unit-tests logd-unit-tests logcat-unit-tests Bug: 35373582 Change-Id: Ia55ef8b95cbb2a841ccb1dae9a24f314735b076a
Diffstat (limited to 'logd/LogTimes.cpp')
-rw-r--r--logd/LogTimes.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index bdaeb751c..04e531f86 100644
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -17,6 +17,8 @@
17#include <errno.h> 17#include <errno.h>
18#include <sys/prctl.h> 18#include <sys/prctl.h>
19 19
20#include <private/android_logger.h>
21
20#include "FlushCommand.h" 22#include "FlushCommand.h"
21#include "LogBuffer.h" 23#include "LogBuffer.h"
22#include "LogReader.h" 24#include "LogReader.h"
@@ -26,7 +28,7 @@ pthread_mutex_t LogTimeEntry::timesLock = PTHREAD_MUTEX_INITIALIZER;
26 28
27LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client, 29LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client,
28 bool nonBlock, unsigned long tail, 30 bool nonBlock, unsigned long tail,
29 unsigned int logMask, pid_t pid, uint64_t start, 31 unsigned int logMask, pid_t pid, log_time start,
30 uint64_t timeout) 32 uint64_t timeout)
31 : mRefCount(1), 33 : mRefCount(1),
32 mRelease(false), 34 mRelease(false),
@@ -42,7 +44,7 @@ LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client,
42 mClient(client), 44 mClient(client),
43 mStart(start), 45 mStart(start),
44 mNonBlock(nonBlock), 46 mNonBlock(nonBlock),
45 mEnd(LogBufferElement::getCurrentSequence()) { 47 mEnd(log_time(android_log_clockid())) {
46 mTimeout.tv_sec = timeout / NS_PER_SEC; 48 mTimeout.tv_sec = timeout / NS_PER_SEC;
47 mTimeout.tv_nsec = timeout % NS_PER_SEC; 49 mTimeout.tv_nsec = timeout % NS_PER_SEC;
48 pthread_cond_init(&threadTriggeredCondition, NULL); 50 pthread_cond_init(&threadTriggeredCondition, NULL);
@@ -132,7 +134,7 @@ void* LogTimeEntry::threadStart(void* obj) {
132 134
133 lock(); 135 lock();
134 136
135 uint64_t start = me->mStart; 137 log_time start = me->mStart;
136 138
137 while (me->threadRunning && !me->isError_Locked()) { 139 while (me->threadRunning && !me->isError_Locked()) {
138 if (me->mTimeout.tv_sec || me->mTimeout.tv_nsec) { 140 if (me->mTimeout.tv_sec || me->mTimeout.tv_nsec) {
@@ -163,7 +165,7 @@ void* LogTimeEntry::threadStart(void* obj) {
163 break; 165 break;
164 } 166 }
165 167
166 me->mStart = start + 1; 168 me->mStart = start + log_time(0, 1);
167 169
168 if (me->mNonBlock || !me->threadRunning || me->isError_Locked()) { 170 if (me->mNonBlock || !me->threadRunning || me->isError_Locked()) {
169 break; 171 break;
@@ -198,7 +200,7 @@ int LogTimeEntry::FilterFirstPass(const LogBufferElement* element, void* obj) {
198 } 200 }
199 201
200 if (me->mCount == 0) { 202 if (me->mCount == 0) {
201 me->mStart = element->getSequence(); 203 me->mStart = element->getRealTime();
202 } 204 }
203 205
204 if ((!me->mPid || (me->mPid == element->getPid())) && 206 if ((!me->mPid || (me->mPid == element->getPid())) &&
@@ -217,7 +219,7 @@ int LogTimeEntry::FilterSecondPass(const LogBufferElement* element, void* obj) {
217 219
218 LogTimeEntry::lock(); 220 LogTimeEntry::lock();
219 221
220 me->mStart = element->getSequence(); 222 me->mStart = element->getRealTime();
221 223
222 if (me->skipAhead[element->getLogId()]) { 224 if (me->skipAhead[element->getLogId()]) {
223 me->skipAhead[element->getLogId()]--; 225 me->skipAhead[element->getLogId()]--;