summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-06-18 13:42:02 -0700
committerAndy Hung <hunga@google.com>2015-06-18 13:43:51 -0700
commit40eb1a1f8871909c272e72afaf7d5af84fea2412 (patch)
tree93cd7cb7f509034600ea627568e2e25a159d3242 /services/audioflinger/Threads.cpp
parentbd974011599b6d4ff47c1cee36d617f191dc0c2f (diff)
downloadframeworks_av-40eb1a1f8871909c272e72afaf7d5af84fea2412.zip
frameworks_av-40eb1a1f8871909c272e72afaf7d5af84fea2412.tar.gz
frameworks_av-40eb1a1f8871909c272e72afaf7d5af84fea2412.tar.bz2
Reduce log messages on AudioFlinger throttle
Bug: 21858740 Change-Id: I8f291b64c1033867bb57ffceaa3b7d94aa998715
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r--services/audioflinger/Threads.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 489f2d4..410fff5 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2194,6 +2194,8 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l()
// Check if we want to throttle the processing to no more than 2x normal rate
mThreadThrottle = property_get_bool("af.thread.throttle", true /* default_value */);
+ mThreadThrottleTimeMs = 0;
+ mThreadThrottleEndMs = 0;
mHalfBufferMs = mNormalFrameCount * 1000 / (2 * mSampleRate);
// mSinkBuffer is the sink buffer. Size is always multiple-of-16 frames.
@@ -2960,8 +2962,19 @@ bool AudioFlinger::PlaybackThread::threadLoop()
const int32_t throttleMs = mHalfBufferMs - deltaMs;
if ((signed)mHalfBufferMs >= throttleMs && throttleMs > 0) {
usleep(throttleMs * 1000);
- ALOGD("mixer(%p) throttle: ret(%zd) deltaMs(%d) requires sleep %d ms",
+ // notify of throttle start on verbose log
+ ALOGV_IF(mThreadThrottleEndMs == mThreadThrottleTimeMs,
+ "mixer(%p) throttle begin:"
+ " ret(%zd) deltaMs(%d) requires sleep %d ms",
this, ret, deltaMs, throttleMs);
+ mThreadThrottleTimeMs += throttleMs;
+ } else {
+ uint32_t diff = mThreadThrottleTimeMs - mThreadThrottleEndMs;
+ if (diff > 0) {
+ // notify of throttle end on debug log
+ ALOGD("mixer(%p) throttle end: throttle time(%u)", this, diff);
+ mThreadThrottleEndMs = mThreadThrottleTimeMs;
+ }
}
}
}
@@ -4340,7 +4353,7 @@ void AudioFlinger::MixerThread::dumpInternals(int fd, const Vector<String16>& ar
String8 result;
PlaybackThread::dumpInternals(fd, args);
-
+ dprintf(fd, " Thread throttle time (msecs): %u\n", mThreadThrottleTimeMs);
dprintf(fd, " AudioMixer tracks: 0x%08x\n", mAudioMixer->trackNames());
// Make a non-atomic copy of fast mixer dump state so it won't change underneath us