9#include <CoreAudio/AudioServerPlugIn.h>
83 const char*
Name =
nullptr;
139 virtual void Message(
const char* format, ...) __attribute__((format(printf, 2, 3)));
164 virtual
void Print(const
char* message);
173 struct ThreadLocalState
175 UInt32 DepthCounter = 0;
176 UInt32 IgnoreCounter = 0;
179 static void* CreateThreadLocalState();
180 static void DestroyThreadLocalState(
void*);
182 ThreadLocalState& GetThreadLocalState();
184 static constexpr size_t MaxMessageLen = 1024;
189 pthread_key_t threadKey_;
@ Noop
No operation. Don't perform any tracing.
@ Syslog
System log. Send all messages to syslog().
@ Stderr
Standard error stream. Send all messages to stderr.
@ Custom
Custom mode. Use if derived class does something different.
virtual std::string FormatOperationEnd(const Operation &operation, OSStatus status, UInt32 depth)
Format operation end message into string. Called by default implementation of OperationEnd().
virtual void Message(const char *format,...) __attribute__((format(printf
Called to print message to log. Default implementation formats arguments and calls Print().
@ Hierarchical
Indent nested operations.
virtual void Print(const char *message)
Print message somewhere. Default implementation sends message to syslog if mode is Mode::Syslog,...
virtual void virtual void OperationEnd(const Operation &operation, OSStatus status)
Called when an operations completes. Zero status indicates operation success. Default implementation ...
virtual void OperationBegin(const Operation &operation)
Called when an operations starts. Default implementation formats arguments and calls Print().
virtual bool ShouldIgnore(const Operation &operation)
Check whether the operation should be excluded from tracing. If this method returns true,...
Tracer(Mode mode=Mode::Syslog, Style style=Style::Hierarchical)
Initialize tracer. Mode defines where to send messages. Style defines how to format messages.
virtual std::string FormatOperationBegin(const Operation &operation, UInt32 depth)
Format operation begin message into string. Called by default implementation of OperationBegin().
virtual std::string FormatMessage(const char *message, UInt32 depth)
Format message into string. Called by default implementation of Message().
static constexpr UInt32 Realtime
This operation is intended to be called on real-time thread on hot path. Such operations are traced o...
static constexpr UInt32 Readonly
This operation is read-only, i.e. doesn't change object state.
UInt32 InDataSize
Input size. Non-zero for operations that have input or output data.
UInt32 QualifierDataSize
Qualifier size. May be zero.
const void * QualifierData
Qualifier data. May be null.
const void * InData
Input data. Non-null for operations that have input data.
const AudioObjectPropertyAddress * PropertyAddress
Address of property. May be null.
const char * Name
Operation name.
const void * OutData
Output data. Non-null for operations that have output data.
AudioObjectID ObjectID
ID of object for which operation was initiated.
pid_t ClientPID
PID of client which initiated operation.
const UInt32 * OutDataSize
Output size. Non-null for operations that have output data.