OSDN Git Service

Remove conditional compilation of ATRACE functions
authorAlex Ray <aray@google.com>
Fri, 30 Nov 2012 19:11:54 +0000 (11:11 -0800)
committerAlex Ray <aray@google.com>
Fri, 30 Nov 2012 19:11:54 +0000 (11:11 -0800)
Tracing functions are meant to be dynamically controlled via sysprops.
Conditional compilation removes this functionality.

Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a

services/audioflinger/Android.mk
services/audioflinger/FastMixer.cpp
services/audioflinger/Threads.cpp

index c4050b8..dc65833 100644 (file)
@@ -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
index 2160ea3..0366dfe 100644 (file)
 #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 <sys/atomics.h>
 #include <time.h>
 #include <utils/Log.h>
index 6cada0a..fd64395 100644 (file)
@@ -18,6 +18,7 @@
 
 #define LOG_TAG "AudioFlinger"
 //#define LOG_NDEBUG 0
+#define ATRACE_TAG ATRACE_TAG_AUDIO
 
 #include <math.h>
 #include <fcntl.h>
@@ -25,6 +26,7 @@
 #include <cutils/properties.h>
 #include <cutils/compiler.h>
 #include <utils/Log.h>
+#include <utils/Trace.h>
 
 #include <private/media/AudioTrackShared.h>
 #include <hardware/audio.h>
@@ -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;