logd: rename LogTimes -> LogReaderThread
LogTimes has evolved from being simply a store of the last timestamp
that each reader has read to being a class representing an individual
reader thread, including the thread function, so name it
appropriately.
Test: logging unit tests
Change-Id: I6914824376a6ff1f7509e657fa4dc044ead62954
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index a3e4e09..f2d247e 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -93,16 +93,16 @@
}
// Release any sleeping reader threads to dump their current content.
- LogTimeEntry::wrlock();
+ LogReaderThread::wrlock();
LastLogTimes::iterator times = mTimes.begin();
while (times != mTimes.end()) {
- LogTimeEntry* entry = times->get();
+ LogReaderThread* entry = times->get();
entry->triggerReader_Locked();
times++;
}
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
}
LogBuffer::LogBuffer(LastLogTimes* times, LogTags* tags, PruneList* prune)
@@ -579,7 +579,7 @@
// If the selected reader is blocking our pruning progress, decide on
// what kind of mitigation is necessary to unblock the situation.
-void LogBuffer::kickMe(LogTimeEntry* me, log_id_t id, unsigned long pruneRows) {
+void LogBuffer::kickMe(LogReaderThread* me, log_id_t id, unsigned long pruneRows) {
if (stats.sizes(id) > (2 * log_buffer_size(id))) { // +100%
// A misbehaving or slow reader has its connection
// dropped if we hit too much memory pressure.
@@ -647,16 +647,16 @@
// LogBuffer::wrlock() must be held when this function is called.
//
bool LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) {
- LogTimeEntry* oldest = nullptr;
+ LogReaderThread* oldest = nullptr;
bool busy = false;
bool clearAll = pruneRows == ULONG_MAX;
- LogTimeEntry::rdlock();
+ LogReaderThread::rdlock();
// Region locked?
LastLogTimes::iterator times = mTimes.begin();
while (times != mTimes.end()) {
- LogTimeEntry* entry = times->get();
+ LogReaderThread* entry = times->get();
if (entry->isWatching(id) &&
(!oldest || (oldest->mStart > entry->mStart) ||
((oldest->mStart == entry->mStart) &&
@@ -692,7 +692,7 @@
break;
}
}
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
return busy;
}
@@ -953,7 +953,7 @@
}
}
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
return (pruneRows > 0) && busy;
}
@@ -976,10 +976,10 @@
// readers and let the clear run (below) deal with determining
// if we are still blocked and return an error code to caller.
if (busy) {
- LogTimeEntry::wrlock();
+ LogReaderThread::wrlock();
LastLogTimes::iterator times = mTimes.begin();
while (times != mTimes.end()) {
- LogTimeEntry* entry = times->get();
+ LogReaderThread* entry = times->get();
// Killer punch
if (entry->isWatching(id)) {
android::prdebug(
@@ -989,7 +989,7 @@
}
times++;
}
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
}
}
wrlock();