Bug 1471588 - Add macro for tracing with comment on the audio thread. r?padenot
MozReview-Commit-ID: JKr2DfEWAl2
--- a/dom/media/Tracing.h
+++ b/dom/media/Tracing.h
@@ -42,27 +42,32 @@
* displaying those elements in two separate lanes.
* The other thread have "normal" tid. Hashing allows being able to get a
* string representation that is unique and guaranteed to be portable. */
#define TRACE_AUDIO_CALLBACK() \
AutoTracer trace(gMSGTraceLogger, FUNCTION_SIGNATURE, getpid(), 0);
#define TRACE_AUDIO_CALLBACK_BUDGET(aFrames, aSampleRate) \
AutoTracer budget(gMSGTraceLogger, "Real-time budget", getpid(), 1, \
AutoTracer::EventType::BUDGET, aFrames, aSampleRate);
+ #define TRACE_AUDIO_CALLBACK_COMMENT(aFmt, ...) \
+ AutoTracer trace(gMSGTraceLogger, FUNCTION_SIGNATURE, getpid(), 0, \
+ AutoTracer::EventType::DURATION, \
+ aFmt, ##__VA_ARGS__);
#define TRACE() \
AutoTracer trace(gMSGTraceLogger, FUNCTION_SIGNATURE, getpid(), \
std::hash<std::thread::id>{}(std::this_thread::get_id()));
#define TRACE_COMMENT(aFmt, ...) \
AutoTracer trace(gMSGTraceLogger, FUNCTION_SIGNATURE, getpid(), \
std::hash<std::thread::id>{}(std::this_thread::get_id()), \
AutoTracer::EventType::DURATION, \
aFmt, ##__VA_ARGS__);
#else
#define TRACE_AUDIO_CALLBACK()
#define TRACE_AUDIO_CALLBACK_BUDGET(aFrames, aSampleRate)
+ #define TRACE_AUDIO_CALLBACK_COMMENT(aFmt, ...)
#define TRACE()
#define TRACE_COMMENT(aFmt, ...)
#endif
class MOZ_RAII AutoTracer
{
public:
static const int32_t BUFFER_SIZE = mozilla::AsyncLogger::MAX_MESSAGE_LENGTH / 2;