summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2017-03-31 12:48:39 -0500
committerMark Salyzyn2017-03-31 15:56:38 -0500
commitae2abf112ca8555dfc09eb1fc4b8bd637e4bc7cc (patch)
tree03f49354b1db487e77249381ac1148f13b3a1470 /logd/LogTimes.cpp
parentcf29755e281a2027e79f8fbe5863ae37a8a72f62 (diff)
downloadplatform-system-core-ae2abf112ca8555dfc09eb1fc4b8bd637e4bc7cc.tar.gz
platform-system-core-ae2abf112ca8555dfc09eb1fc4b8bd637e4bc7cc.tar.xz
platform-system-core-ae2abf112ca8555dfc09eb1fc4b8bd637e4bc7cc.zip
logd: correctly label identical lines
Move lastTid array from local in LogBuffer::flushTo to per-reader context in LogTimes::mLastTid and pass into LogBuffer::flushTo. Replace NULL with nullptr in touched files. Simplify LogTimeEntry::cleanSkip_Locked initialization of skipAhead to memset, to match mLastTid memset initialization. Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests Test: adb logcat -b all | grep chatty | grep -v identical Bug: 36488201 Change-Id: I0c3887f220a57f80c0490be4b182657b9563aa3f
Diffstat (limited to 'logd/LogTimes.cpp')
-rw-r--r--logd/LogTimes.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index 04e531f86..ccc550a73 100644
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <errno.h> 17#include <errno.h>
18#include <string.h>
18#include <sys/prctl.h> 19#include <sys/prctl.h>
19 20
20#include <private/android_logger.h> 21#include <private/android_logger.h>
@@ -47,7 +48,8 @@ LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client,
47 mEnd(log_time(android_log_clockid())) { 48 mEnd(log_time(android_log_clockid())) {
48 mTimeout.tv_sec = timeout / NS_PER_SEC; 49 mTimeout.tv_sec = timeout / NS_PER_SEC;
49 mTimeout.tv_nsec = timeout % NS_PER_SEC; 50 mTimeout.tv_nsec = timeout % NS_PER_SEC;
50 pthread_cond_init(&threadTriggeredCondition, NULL); 51 memset(mLastTid, 0, sizeof(mLastTid));
52 pthread_cond_init(&threadTriggeredCondition, nullptr);
51 cleanSkip_Locked(); 53 cleanSkip_Locked();
52} 54}
53 55
@@ -98,7 +100,7 @@ void LogTimeEntry::threadStop(void* obj) {
98 it++; 100 it++;
99 } 101 }
100 102
101 me->mClient = NULL; 103 me->mClient = nullptr;
102 reader.release(client); 104 reader.release(client);
103 } 105 }
104 106
@@ -122,7 +124,7 @@ void* LogTimeEntry::threadStart(void* obj) {
122 SocketClient* client = me->mClient; 124 SocketClient* client = me->mClient;
123 if (!client) { 125 if (!client) {
124 me->error(); 126 me->error();
125 return NULL; 127 return nullptr;
126 } 128 }
127 129
128 LogBuffer& logbuf = me->mReader.logbuf(); 130 LogBuffer& logbuf = me->mReader.logbuf();
@@ -151,12 +153,12 @@ void* LogTimeEntry::threadStart(void* obj) {
151 unlock(); 153 unlock();
152 154
153 if (me->mTail) { 155 if (me->mTail) {
154 logbuf.flushTo(client, start, privileged, security, FilterFirstPass, 156 logbuf.flushTo(client, start, nullptr, privileged, security,
155 me); 157 FilterFirstPass, me);
156 me->leadingDropped = true; 158 me->leadingDropped = true;
157 } 159 }
158 start = logbuf.flushTo(client, start, privileged, security, 160 start = logbuf.flushTo(client, start, me->mLastTid, privileged,
159 FilterSecondPass, me); 161 security, FilterSecondPass, me);
160 162
161 lock(); 163 lock();
162 164
@@ -182,7 +184,7 @@ void* LogTimeEntry::threadStart(void* obj) {
182 184
183 pthread_cleanup_pop(true); 185 pthread_cleanup_pop(true);
184 186
185 return NULL; 187 return nullptr;
186} 188}
187 189
188// A first pass to count the number of elements 190// A first pass to count the number of elements
@@ -281,7 +283,5 @@ stop:
281} 283}
282 284
283void LogTimeEntry::cleanSkip_Locked(void) { 285void LogTimeEntry::cleanSkip_Locked(void) {
284 for (log_id_t i = LOG_ID_MIN; i < LOG_ID_MAX; i = (log_id_t)(i + 1)) { 286 memset(skipAhead, 0, sizeof(skipAhead));
285 skipAhead[i] = 0;
286 }
287} 287}