Removed LOG_HIST_FLUSH
Turning audio on and off does not cause this event to be
written to the buffer. Now, a call to dumpsys media.log
simply writes to console an analysis of the data in memory,
and does not delete it afterwards.
Test: dumpsys media.log
Change-Id: Ie75fb27ec4050fb3891635f4c7933196cfd03643
diff --git a/media/libnbaio/NBLog.cpp b/media/libnbaio/NBLog.cpp
index 73adff6..3cbd06f 100644
--- a/media/libnbaio/NBLog.cpp
+++ b/media/libnbaio/NBLog.cpp
@@ -23,7 +23,7 @@
* Called every period length (e.g., 4ms)
* Calls LOG_HIST_TS
* LOG_HIST_TS
-* Hashes file name and line number
+* Hashes file name and line number, and writes single timestamp to buffer
* calls NBLOG::Writer::logHistTS once
* NBLOG::Writer::logHistTS
* calls NBLOG::Writer::log on hash and current timestamp
@@ -45,21 +45,7 @@
* Determines readable buffer section via pointer arithmetic on reader
* and writer pointers
*
-* 2) Writing LOG_HIST_FLUSH event to console when audio is turned on or off
-* When this event is found when reading from the buffer, all histograms are
-* printed to the console
-* TODO: remove this: always write data to another data structure or the console
-* FastMixer::onStateChange()
-* is called when audio is turned on/off
-* calls LOG_HIST_FLUSH()
-* LOG_HIST_FLUSH()
-* calls logHistFlush
-* NBLog::Writer::logHistFlush
-* records current timestamp
-* calls log(EVENT_HISTOGRAM_FLUSH)
-* From here, everything is the same as in 1), resulting in call to fifo write
-*
-* 3) reading the data from shared memory
+* 2) reading the data from shared memory
* Thread::threadloop()
* TODO: add description?
* NBLog::MergeThread::threadLoop()
@@ -76,7 +62,7 @@
* moves the fifo reader index to after the last entry read
* in this case, the buffer is in shared memory. in (4), the buffer is private
*
-* 4) reading the data from private buffer
+* 3) reading the data from private buffer
* MediaLogService::dump
* calls NBLog::Reader::dump(CONSOLE)
* The private buffer contains all logs for all readers in shared memory
@@ -88,9 +74,7 @@
* (string, timestamp, etc...)
* In the case of EVENT_HISTOGRAM_ENTRY_TS, adds a list of timestamp sequences
* (histogram entry) to NBLog::mHists
-* In the case of EVENT_HISTOGRAM_FLUSH, calls drawHistogram on each element in
-* the list and erases it
-* TODO: get rid of the FLUSH, instead add every HISTOGRAM_ENTRY_TS to two
+* TODO: add every HISTOGRAM_ENTRY_TS to two
* circular buffers: one short-term and one long-term (can add even longer-term
* structures in the future). When dump is called, print everything currently
* in the buffer.
@@ -154,7 +138,6 @@
switch (type) {
case EVENT_START_FMT:
return std::make_unique<FormatEntry>(FormatEntry(ptr));
- case EVENT_HISTOGRAM_FLUSH:
case EVENT_HISTOGRAM_ENTRY_TS:
return std::make_unique<HistogramEntry>(HistogramEntry(ptr));
default:
@@ -548,21 +531,6 @@
}
}
-void NBLog::Writer::logHistFlush(log_hash_t hash)
-{
- if (!mEnabled) {
- return;
- }
- HistTsEntry data;
- data.hash = hash;
- data.ts = get_monotonic_ns();
- if (data.ts > 0) {
- log(EVENT_HISTOGRAM_FLUSH, &data, sizeof(data));
- } else {
- ALOGE("Failed to get timestamp");
- }
-}
-
void NBLog::Writer::logFormat(const char *fmt, log_hash_t hash, ...)
{
if (!mEnabled) {
@@ -790,8 +758,7 @@
const std::set<NBLog::Event> NBLog::Reader::startingTypes {NBLog::Event::EVENT_START_FMT,
NBLog::Event::EVENT_HISTOGRAM_ENTRY_TS};
const std::set<NBLog::Event> NBLog::Reader::endingTypes {NBLog::Event::EVENT_END_FMT,
- NBLog::Event::EVENT_HISTOGRAM_ENTRY_TS,
- NBLog::Event::EVENT_HISTOGRAM_FLUSH};
+ NBLog::Event::EVENT_HISTOGRAM_ENTRY_TS};
NBLog::Reader::Reader(const void *shared, size_t size)
: mShared((/*const*/ Shared *) shared), /*mIMemory*/
mFd(-1), mIndent(0),
@@ -986,10 +953,6 @@
++entry;
break;
}
- case EVENT_HISTOGRAM_FLUSH: {
- ++entry;
- break;
- }
case EVENT_END_FMT:
body.appendFormat("warning: got to end format event");
++entry;
diff --git a/media/libnbaio/include/NBLog.h b/media/libnbaio/include/NBLog.h
index f2a7427..6b08e94 100644
--- a/media/libnbaio/include/NBLog.h
+++ b/media/libnbaio/include/NBLog.h
@@ -60,7 +60,6 @@
EVENT_HASH, // unique HASH of log origin, originates from hash of file name
// and line number
EVENT_HISTOGRAM_ENTRY_TS, // single datum for timestamp histogram
- EVENT_HISTOGRAM_FLUSH, // show histogram on log
EVENT_END_FMT, // end of logFormat argument list
EVENT_UPPER_BOUND, // to check for invalid events
@@ -343,7 +342,6 @@
virtual void logEnd();
virtual void logHash(log_hash_t hash);
virtual void logHistTS(log_hash_t hash);
- virtual void logHistFlush(log_hash_t hash);
virtual bool isEnabled() const;
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index c4f1af3..c4a0c0d 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -138,7 +138,6 @@
void FastMixer::onStateChange()
{
- LOG_HIST_FLUSH();
const FastMixerState * const current = (const FastMixerState *) mCurrent;
const FastMixerState * const previous = (const FastMixerState *) mPrevious;
FastMixerDumpState * const dumpState = (FastMixerDumpState *) mDumpState;
diff --git a/services/audioflinger/TypedLogger.h b/services/audioflinger/TypedLogger.h
index 2d84028..83aa6a1 100644
--- a/services/audioflinger/TypedLogger.h
+++ b/services/audioflinger/TypedLogger.h
@@ -90,10 +90,6 @@
#define LOG_HIST_TS() do { NBLog::Writer *x = tlNBLogWriter; if (x != nullptr) \
x->logHistTS(hash(__FILE__, __LINE__)); } while(0)
-// flush all histogram
-#define LOG_HIST_FLUSH() do { NBLog::Writer *x = tlNBLogWriter; if (x != nullptr) \
- x->logHistFlush(hash(__FILE__, __LINE__)); } while(0)
-
namespace android {
extern "C" {
extern thread_local NBLog::Writer *tlNBLogWriter;