| 1 |
//======================================================================== |
| 2 |
// |
| 3 |
// Trace.h |
| 4 |
// |
| 5 |
// Nested tracing. |
| 6 |
// |
| 7 |
// Copyright 2020 Glyph & Cog, LLC |
| 8 |
// |
| 9 |
//======================================================================== |
| 10 |
|
| 11 |
#ifndef TRACING_H |
| 12 |
#define TRACING_H |
| 13 |
|
| 14 |
#include <aconf.h> |
| 15 |
|
| 16 |
#if ENABLE_TRACING |
| 17 |
|
| 18 |
// Enter a nesting level. |
| 19 |
extern void traceBegin(void *nestHandle, const char *fmt, ...); |
| 20 |
|
| 21 |
// Exit a nesting level. |
| 22 |
extern void traceEnd(void *nestHandle, const char *fmt, ...); |
| 23 |
|
| 24 |
// Mark a resource as allocated. |
| 25 |
extern void traceAlloc(void *resourceHandle, const char *fmt, ...); |
| 26 |
|
| 27 |
// Mark a resource as freed. |
| 28 |
extern void traceFree(void *resourceHandle, const char *fmt, ...); |
| 29 |
|
| 30 |
// Misc message. |
| 31 |
extern void traceMessage(const char *fmt, ...); |
| 32 |
|
| 33 |
#else // ENABLE_TRACING |
| 34 |
|
| 35 |
static inline void traceBegin(void *nestHandle, const char *fmt, ...) {} |
| 36 |
static inline void traceEnd(void *nestHandle, const char *fmt, ...) {} |
| 37 |
static inline void traceAlloc(void *resourceHandle, const char *fmt, ...) {} |
| 38 |
static inline void traceFree(void *nestHandle, const char *fmt, ...) {} |
| 39 |
static inline void traceMessage(const char *fmt, ...) {} |
| 40 |
|
| 41 |
#endif // ENABLE_TRACING |
| 42 |
|
| 43 |
#endif // TRACING_H |