diff options
author | Jamie Gennis <jgennis@google.com> | 2012-04-16 20:34:58 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2012-04-16 20:36:25 -0700 |
commit | 695e331f01b136155b1559b3c878b7c5bb631bc1 (patch) | |
tree | 1c08a6210f54966430ec419ddf4590dd84d4086f /libs | |
parent | 91a6826d6794c19cdedfa58c42f8820c5cf5fe2b (diff) | |
download | frameworks_native-695e331f01b136155b1559b3c878b7c5bb631bc1.zip frameworks_native-695e331f01b136155b1559b3c878b7c5bb631bc1.tar.gz frameworks_native-695e331f01b136155b1559b3c878b7c5bb631bc1.tar.bz2 |
BufferQueue: check before tracing buffer index
This change adds a check on ATRACE_ENABLED before calling snprintf to trace the
buffer index.
Change-Id: Id79430f9c69706393efd3d10780a4cc97055e9e0
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/BufferQueue.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 01d08b7..ece0494 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -57,9 +57,12 @@ #define ST_LOGE(x, ...) ALOGE("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) #define ATRACE_BUFFER_INDEX(index) \ - char ___traceBuf[1024]; \ - snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), (index)); \ - android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); + if (ATRACE_ENABLED()) { \ + char ___traceBuf[1024]; \ + snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), \ + (index)); \ + android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); \ + } namespace android { |