From af348741539ae4a84aa929a54ecf359dae96f3ee Mon Sep 17 00:00:00 2001 From: Alex Ray Date: Fri, 30 Nov 2012 11:11:54 -0800 Subject: [PATCH] Remove conditional compilation of ATRACE functions Tracing functions are meant to be dynamically controlled via sysprops. Conditional compilation removes this functionality. Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a --- services/audioflinger/Android.mk | 3 --- services/audioflinger/FastMixer.cpp | 5 +++++ services/audioflinger/Threads.cpp | 10 +++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk index c4050b84f7..dc658333de 100644 --- a/services/audioflinger/Android.mk +++ b/services/audioflinger/Android.mk @@ -66,9 +66,6 @@ LOCAL_CFLAGS += -DSTATE_QUEUE_INSTANTIATIONS='"StateQueueInstantiations.cpp"' LOCAL_CFLAGS += -UFAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE -# uncomment for systrace -# LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_AUDIO - # uncomment for dumpsys to write most recent audio output to .wav file # 47.5 seconds at 44.1 kHz, 8 megabytes # LOCAL_CFLAGS += -DTEE_SINK_FRAMES=0x200000 diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp index 2160ea3c7f..0366dfe262 100644 --- a/services/audioflinger/FastMixer.cpp +++ b/services/audioflinger/FastMixer.cpp @@ -17,6 +17,11 @@ #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 + #include #include #include diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 6cada0a7f0..fd64395cd0 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "AudioFlinger" //#define LOG_NDEBUG 0 +#define ATRACE_TAG ATRACE_TAG_AUDIO #include #include @@ -25,6 +26,7 @@ #include #include #include +#include #include #include @@ -1652,9 +1654,7 @@ void AudioFlinger::PlaybackThread::threadLoop_write() if (mNormalSink != 0) { #define mBitShift 2 // FIXME size_t count = mixBufferSize >> mBitShift; -#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER) ATRACE_BEGIN("write"); -#endif // update the setpoint when AudioFlinger::mScreenState changes uint32_t screenState = AudioFlinger::mScreenState; if (screenState != mScreenState) { @@ -1666,9 +1666,7 @@ void AudioFlinger::PlaybackThread::threadLoop_write() } } ssize_t framesWritten = mNormalSink->write(mMixBuffer, count); -#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER) ATRACE_END(); -#endif if (framesWritten > 0) { bytesWritten = framesWritten << mBitShift; } else { @@ -2000,9 +1998,7 @@ if (mType == MIXER) { if (!mStandby && delta > maxPeriod) { mNumDelayedWrites++; if ((now - lastWarning) > kWarningThrottleNs) { -#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER) - ScopedTrace st(ATRACE_TAG, "underrun"); -#endif + ATRACE_NAME("underrun"); ALOGW("write blocked for %llu msecs, %d delayed writes, thread %p", ns2ms(delta), mNumDelayedWrites, this); lastWarning = now; -- 2.11.0