audio: Add tracing to audio I/O and effect processing

Emit trace events for audio reads and writes and effect
processing functions. This is to match the HIDL implementation.

Bug: 321233946
Test: `record_android_trace` with `audio` category enabled
Change-Id: I26907b09243fd3e5aaa470a0fb930b34addd3093
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index cf0870e..807348f 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -16,14 +16,14 @@
 
 #include <pthread.h>
 
+#define ATRACE_TAG ATRACE_TAG_AUDIO
 #define LOG_TAG "AHAL_Stream"
+#include <Utils.h>
 #include <android-base/logging.h>
 #include <android/binder_ibinder_platform.h>
 #include <utils/SystemClock.h>
+#include <utils/Trace.h>
 
-#include <Utils.h>
-
-#include "core-impl/Module.h"
 #include "core-impl/Stream.h"
 
 using aidl::android::hardware::audio::common::AudioOffloadMetadata;
@@ -312,6 +312,7 @@
 }
 
 bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply) {
+    ATRACE_CALL();
     StreamContext::DataMQ* const dataMQ = mContext->getDataMQ();
     const size_t byteCount = std::min({clientSize, dataMQ->availableToWrite(), mDataBufferSize});
     const bool isConnected = mIsConnected;
@@ -583,6 +584,7 @@
 }
 
 bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* reply) {
+    ATRACE_CALL();
     StreamContext::DataMQ* const dataMQ = mContext->getDataMQ();
     const size_t readByteCount = dataMQ->availableToRead();
     const size_t frameSize = mContext->getFrameSize();