Loading services/audioflinger/Configuration.h +2 −3 Original line number Diff line number Diff line Loading @@ -29,9 +29,8 @@ // uncomment to display CPU load adjusted for CPU frequency //#define CPU_FREQUENCY_STATISTICS // uncomment to enable fast mixer to take performance samples for later statistical analysis #define FAST_MIXER_STATISTICS // FIXME rename to FAST_THREAD_STATISTICS // uncomment to enable fast threads to take performance samples for later statistical analysis #define FAST_THREAD_STATISTICS // uncomment for debugging timing problems related to StateQueue::push() //#define STATE_QUEUE_DUMP Loading services/audioflinger/FastMixer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ #include <utils/Log.h> #include <utils/Trace.h> #include <system/audio.h> #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS #include <cpustats/CentralTendencyStatistics.h> #ifdef CPU_FREQUENCY_STATISTICS #include <cpustats/ThreadCpuUsage.h> Loading Loading @@ -82,7 +82,7 @@ FastMixer::FastMixer() : FastThread(), fastTrackNames[i] = -1; generations[i] = 0; } #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS oldLoad.tv_sec = 0; oldLoad.tv_nsec = 0; #endif Loading services/audioflinger/FastMixerDumpState.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ //#define LOG_NDEBUG 0 #include "Configuration.h" #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS #include <cpustats/CentralTendencyStatistics.h> #ifdef CPU_FREQUENCY_STATISTICS #include <cpustats/ThreadCpuUsage.h> Loading @@ -31,7 +31,7 @@ namespace android { FastMixerDumpState::FastMixerDumpState( #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS uint32_t samplingN #endif ) : FastThreadDumpState(), Loading @@ -40,12 +40,12 @@ FastMixerDumpState::FastMixerDumpState( mSampleRate(0), mFrameCount(0), mTrackMask(0) { #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS increaseSamplingN(samplingN); #endif } #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS void FastMixerDumpState::increaseSamplingN(uint32_t samplingN) { if (samplingN <= mSamplingN || samplingN > kSamplingN || roundup(samplingN) != samplingN) { Loading Loading @@ -126,7 +126,7 @@ void FastMixerDumpState::dump(int fd) const mNumTracks, mWriteErrors, mUnderruns, mOverruns, mSampleRate, mFrameCount, measuredWarmupMs, mWarmupCycles, mixPeriodSec * 1e3); #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS // find the interval of valid samples uint32_t bounds = mBounds; uint32_t newestOpen = bounds & 0xFFFF; Loading services/audioflinger/FastMixerDumpState.h +2 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ struct FastTrackDump { // It has a different lifetime than the FastMixer, and so it can't be a member of FastMixer. struct FastMixerDumpState : FastThreadDumpState { FastMixerDumpState( #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS uint32_t samplingN = kSamplingNforLowRamDevice #endif ); Loading @@ -84,7 +84,7 @@ struct FastMixerDumpState : FastThreadDumpState { uint32_t mTrackMask; // mask of active tracks FastTrackDump mTracks[FastMixerState::kMaxFastTracks]; #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS // Compile-time constant for a "low RAM device", must be a power of 2 <= kSamplingN. // This value was chosen such that each array uses 1 small page (4 Kbytes). static const uint32_t kSamplingNforLowRamDevice = 0x400; Loading services/audioflinger/FastThread.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ FastThread::FastThread() : Thread(false /*canCallJava*/), mDummyDumpState(NULL), dumpState(NULL), ignoreNextOverrun(true), #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS // oldLoad oldLoadValid(false), bounds(0), Loading Loading @@ -130,7 +130,7 @@ bool FastThread::threadLoop() if (command & FastThreadState::IDLE) { onIdle(); oldTsValid = false; #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS oldLoadValid = false; #endif ignoreNextOverrun = true; Loading Loading @@ -175,7 +175,7 @@ bool FastThread::threadLoop() warmupConsecutiveInRangeCycles = 0; sleepNs = -1; coldGen = current->mColdGen; #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS bounds = 0; full = false; #endif Loading Loading @@ -281,7 +281,7 @@ bool FastThread::threadLoop() ignoreNextOverrun = false; } } #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS if (isWarm) { // advance the FIFO queue bounds size_t i = bounds & (dumpState->mSamplingN - 1); Loading Loading
services/audioflinger/Configuration.h +2 −3 Original line number Diff line number Diff line Loading @@ -29,9 +29,8 @@ // uncomment to display CPU load adjusted for CPU frequency //#define CPU_FREQUENCY_STATISTICS // uncomment to enable fast mixer to take performance samples for later statistical analysis #define FAST_MIXER_STATISTICS // FIXME rename to FAST_THREAD_STATISTICS // uncomment to enable fast threads to take performance samples for later statistical analysis #define FAST_THREAD_STATISTICS // uncomment for debugging timing problems related to StateQueue::push() //#define STATE_QUEUE_DUMP Loading
services/audioflinger/FastMixer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ #include <utils/Log.h> #include <utils/Trace.h> #include <system/audio.h> #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS #include <cpustats/CentralTendencyStatistics.h> #ifdef CPU_FREQUENCY_STATISTICS #include <cpustats/ThreadCpuUsage.h> Loading Loading @@ -82,7 +82,7 @@ FastMixer::FastMixer() : FastThread(), fastTrackNames[i] = -1; generations[i] = 0; } #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS oldLoad.tv_sec = 0; oldLoad.tv_nsec = 0; #endif Loading
services/audioflinger/FastMixerDumpState.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ //#define LOG_NDEBUG 0 #include "Configuration.h" #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS #include <cpustats/CentralTendencyStatistics.h> #ifdef CPU_FREQUENCY_STATISTICS #include <cpustats/ThreadCpuUsage.h> Loading @@ -31,7 +31,7 @@ namespace android { FastMixerDumpState::FastMixerDumpState( #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS uint32_t samplingN #endif ) : FastThreadDumpState(), Loading @@ -40,12 +40,12 @@ FastMixerDumpState::FastMixerDumpState( mSampleRate(0), mFrameCount(0), mTrackMask(0) { #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS increaseSamplingN(samplingN); #endif } #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS void FastMixerDumpState::increaseSamplingN(uint32_t samplingN) { if (samplingN <= mSamplingN || samplingN > kSamplingN || roundup(samplingN) != samplingN) { Loading Loading @@ -126,7 +126,7 @@ void FastMixerDumpState::dump(int fd) const mNumTracks, mWriteErrors, mUnderruns, mOverruns, mSampleRate, mFrameCount, measuredWarmupMs, mWarmupCycles, mixPeriodSec * 1e3); #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS // find the interval of valid samples uint32_t bounds = mBounds; uint32_t newestOpen = bounds & 0xFFFF; Loading
services/audioflinger/FastMixerDumpState.h +2 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ struct FastTrackDump { // It has a different lifetime than the FastMixer, and so it can't be a member of FastMixer. struct FastMixerDumpState : FastThreadDumpState { FastMixerDumpState( #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS uint32_t samplingN = kSamplingNforLowRamDevice #endif ); Loading @@ -84,7 +84,7 @@ struct FastMixerDumpState : FastThreadDumpState { uint32_t mTrackMask; // mask of active tracks FastTrackDump mTracks[FastMixerState::kMaxFastTracks]; #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS // Compile-time constant for a "low RAM device", must be a power of 2 <= kSamplingN. // This value was chosen such that each array uses 1 small page (4 Kbytes). static const uint32_t kSamplingNforLowRamDevice = 0x400; Loading
services/audioflinger/FastThread.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ FastThread::FastThread() : Thread(false /*canCallJava*/), mDummyDumpState(NULL), dumpState(NULL), ignoreNextOverrun(true), #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS // oldLoad oldLoadValid(false), bounds(0), Loading Loading @@ -130,7 +130,7 @@ bool FastThread::threadLoop() if (command & FastThreadState::IDLE) { onIdle(); oldTsValid = false; #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS oldLoadValid = false; #endif ignoreNextOverrun = true; Loading Loading @@ -175,7 +175,7 @@ bool FastThread::threadLoop() warmupConsecutiveInRangeCycles = 0; sleepNs = -1; coldGen = current->mColdGen; #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS bounds = 0; full = false; #endif Loading Loading @@ -281,7 +281,7 @@ bool FastThread::threadLoop() ignoreNextOverrun = false; } } #ifdef FAST_MIXER_STATISTICS #ifdef FAST_THREAD_STATISTICS if (isWarm) { // advance the FIFO queue bounds size_t i = bounds & (dumpState->mSamplingN - 1); Loading