summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastMixer.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-05-07 11:07:57 -0700
committerGlenn Kasten <gkasten@google.com>2012-05-10 14:20:52 -0700
commitd8e6fd35ec2b59ee7d873daf1f1d9d348221c7bc (patch)
treec5c5a16ca2990abee1a0e0e90d006e9437d3f3ce /services/audioflinger/FastMixer.cpp
parentc3798d7e97cb11076310f06163417c0631cce04e (diff)
downloadframeworks_av-d8e6fd35ec2b59ee7d873daf1f1d9d348221c7bc.zip
frameworks_av-d8e6fd35ec2b59ee7d873daf1f1d9d348221c7bc.tar.gz
frameworks_av-d8e6fd35ec2b59ee7d873daf1f1d9d348221c7bc.tar.bz2
Use audio tag for system tracing
Disabled by default; uncomment ATRACE_TAG to enable Change-Id: I99af894022a859ee5644bd853cfd8a48e4735ff9
Diffstat (limited to 'services/audioflinger/FastMixer.cpp')
-rw-r--r--services/audioflinger/FastMixer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index d499f7a..1492a36 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -17,9 +17,12 @@
#define LOG_TAG "FastMixer"
//#define LOG_NDEBUG 0
+//#define ATRACE_TAG ATRACE_TAG_AUDIO
+
#include <sys/atomics.h>
#include <time.h>
#include <utils/Log.h>
+#include <utils/Trace.h>
#include <system/audio.h>
#ifdef FAST_MIXER_STATISTICS
#include <cpustats/CentralTendencyStatistics.h>
@@ -359,6 +362,7 @@ bool FastMixer::threadLoop()
FastTrackDump *ftDump = &dumpState->mTracks[i];
uint32_t underruns = ftDump->mUnderruns;
if (framesReady < frameCount) {
+ ATRACE_INT("underrun", i);
ftDump->mUnderruns = (underruns + 2) | 1;
if (framesReady == 0) {
mixer->disable(name);
@@ -387,7 +391,9 @@ bool FastMixer::threadLoop()
// FIXME write() is non-blocking and lock-free for a properly implemented NBAIO sink,
// but this code should be modified to handle both non-blocking and blocking sinks
dumpState->mWriteSequence++;
+ Tracer::traceBegin(ATRACE_TAG, "write");
ssize_t framesWritten = outputSink->write(mixBuffer, frameCount);
+ Tracer::traceEnd(ATRACE_TAG);
dumpState->mWriteSequence++;
if (framesWritten >= 0) {
ALOG_ASSERT(framesWritten <= frameCount);
@@ -437,6 +443,7 @@ bool FastMixer::threadLoop()
}
}
if (sec > 0 || nsec > underrunNs) {
+ ScopedTrace st(ATRACE_TAG, "underrun");
// FIXME only log occasionally
ALOGV("underrun: time since last cycle %d.%03ld sec",
(int) sec, nsec / 1000000L);