summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastMixer.cpp
diff options
context:
space:
mode:
authorAlex Ray <aray@google.com>2012-11-30 19:42:28 -0800
committerAlex Ray <aray@google.com>2012-11-30 19:44:24 -0800
commitb3a8364eeea621ef63b983e4c1b0771f62069fe0 (patch)
tree646bee189a8f77d41e87ffc42af3dd097f5ec254 /services/audioflinger/FastMixer.cpp
parentece53e018b38794f7cdf978a605f943f9ec96c3b (diff)
downloadframeworks_av-b3a8364eeea621ef63b983e4c1b0771f62069fe0.zip
frameworks_av-b3a8364eeea621ef63b983e4c1b0771f62069fe0.tar.gz
frameworks_av-b3a8364eeea621ef63b983e4c1b0771f62069fe0.tar.bz2
audioflinger: define ANDROID_SMP, remove conditional tracing
With ANDROID_SMP set, tracing functionality is completely inline, and without the performance hits of external library calls, tracing does not need to be conditionally compiled. Change-Id: I4b29a9a52c403f0d2ea137c5b7bc05a518a7ca4b
Diffstat (limited to 'services/audioflinger/FastMixer.cpp')
-rw-r--r--services/audioflinger/FastMixer.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index 0366dfe..5e6af16 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -17,10 +17,7 @@
#define LOG_TAG "FastMixer"
//#define LOG_NDEBUG 0
-/** Uncomment for systrace.
- * ATRACE_TAG will default to ATRACE_TAG_NEVER in the header.
- */
-//#define ATRACE_TAG ATRACE_TAG_AUDIO
+#define ATRACE_TAG ATRACE_TAG_AUDIO
#include <sys/atomics.h>
#include <time.h>
@@ -376,14 +373,14 @@ bool FastMixer::threadLoop()
// up to 1 ms. If enough active tracks all blocked in sequence, this would result
// in the overall fast mix cycle being delayed. Should use a non-blocking FIFO.
size_t framesReady = fastTrack->mBufferProvider->framesReady();
-#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
- // I wish we had formatted trace names
- char traceName[16];
- strcpy(traceName, "framesReady");
- traceName[11] = i + (i < 10 ? '0' : 'A' - 10);
- traceName[12] = '\0';
- ATRACE_INT(traceName, framesReady);
-#endif
+ if (ATRACE_ENABLED()) {
+ // I wish we had formatted trace names
+ char traceName[16];
+ strcpy(traceName, "framesReady");
+ traceName[11] = i + (i < 10 ? '0' : 'A' - 10);
+ traceName[12] = '\0';
+ ATRACE_INT(traceName, framesReady);
+ }
FastTrackDump *ftDump = &dumpState->mTracks[i];
FastTrackUnderruns underruns = ftDump->mUnderruns;
if (framesReady < frameCount) {
@@ -429,13 +426,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++;
-#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
ATRACE_BEGIN("write");
-#endif
ssize_t framesWritten = outputSink->write(mixBuffer, frameCount);
-#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
ATRACE_END();
-#endif
dumpState->mWriteSequence++;
if (framesWritten >= 0) {
ALOG_ASSERT(framesWritten <= frameCount);
@@ -490,9 +483,7 @@ bool FastMixer::threadLoop()
sleepNs = -1;
if (isWarm) {
if (sec > 0 || nsec > underrunNs) {
-#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
- ScopedTrace st(ATRACE_TAG, "underrun");
-#endif
+ ATRACE_NAME("underrun");
// FIXME only log occasionally
ALOGV("underrun: time since last cycle %d.%03ld sec",
(int) sec, nsec / 1000000L);
@@ -572,10 +563,8 @@ bool FastMixer::threadLoop()
// this store #4 is not atomic with respect to stores #1, #2, #3 above, but
// the newest open and oldest closed halves are atomic with respect to each other
dumpState->mBounds = bounds;
-#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
ATRACE_INT("cycle_ms", monotonicNs / 1000000);
ATRACE_INT("load_us", loadNs / 1000);
-#endif
}
#endif
} else {