|
@@ -22,35 +22,77 @@
|
|
|
* @brief Tracing functions
|
|
|
*/
|
|
|
|
|
|
-#ifndef TRACE_H
|
|
|
-#define TRACE_H
|
|
|
+#ifndef _DMMLIB_TRACE_H_
|
|
|
+#define _DMMLIB_TRACE_H_
|
|
|
#include "dmm_config.h"
|
|
|
|
|
|
-#if TRACE_LEVEL >= 1
|
|
|
+#ifdef WITH_MEM_TRACE
|
|
|
+#include <stdio.h>
|
|
|
+
|
|
|
+#ifndef PARSE_ENV
|
|
|
+/** Memory trace file descriptor */
|
|
|
+#define MEM_FD stderr
|
|
|
+#else /* PARSE_ENV */
|
|
|
+/** Memory trace file descriptor macro */
|
|
|
+#define MEM_FD mem_fd
|
|
|
+/** Memory trace file descriptor */
|
|
|
+FILE* mem_fd;
|
|
|
+#endif /* PARSE_ENV */
|
|
|
+
|
|
|
+/** Function for memory trace messages */
|
|
|
+#define MEM_TRACE(...) fprintf(MEM_FD, __VA_ARGS__)
|
|
|
+
|
|
|
+#else /* WITH_MEM_TRACE */
|
|
|
+
|
|
|
+/** Function for memory trace messages */
|
|
|
+#define MEM_TRACE(...) /* do nothing */
|
|
|
+
|
|
|
+#endif /* WITH_MEM_TRACE */
|
|
|
+
|
|
|
+#ifdef WITH_STATS_TRACE
|
|
|
+#include <stdio.h>
|
|
|
+
|
|
|
+#ifndef PARSE_ENV
|
|
|
+/** Statistics file descriptor */
|
|
|
+#define STATS_FD stderr
|
|
|
+#else /* PARSE_ENV */
|
|
|
+/** Statistics file descriptor macro */
|
|
|
+#define STATS_FD stats_fd
|
|
|
+/** Statistics file descriptor */
|
|
|
+FILE* stats_fd;
|
|
|
+#endif /* PARSE_ENV */
|
|
|
|
|
|
+/** Function for statistics trace messages */
|
|
|
+#define STATS_TRACE(...) fprintf(STATS_FD, __VA_ARGS__)
|
|
|
+
|
|
|
+#else /* WITH_STATS_TRACE */
|
|
|
+
|
|
|
+/** Function for statistics trace messages */
|
|
|
+#define STATS_TRACE(...) /* do nothing */
|
|
|
+
|
|
|
+#endif /* WITH_STATS_TRACE */
|
|
|
+
|
|
|
+#ifdef WITH_DEBUG
|
|
|
#include <stdio.h>
|
|
|
|
|
|
-/** Function for Level 1 trace messages */
|
|
|
-#define TRACE_1(...) fprintf(stderr, __VA_ARGS__)
|
|
|
-#else /* TRACE_LEVEL >= 1 */
|
|
|
-/** Function for Level 1 trace messages */
|
|
|
-#define TRACE_1(...) /* do nothing */
|
|
|
-#endif /* TRACE_LEVEL >= 1 */
|
|
|
-
|
|
|
-#if TRACE_LEVEL >= 2
|
|
|
-/** Function for Level 2 trace messages */
|
|
|
-#define TRACE_2(...) fprintf(stderr, __VA_ARGS__)
|
|
|
-#else /* TRACE_LEVEL >= 2 */
|
|
|
-/** Function for Level 2 trace messages */
|
|
|
-#define TRACE_2(...) /* do nothing */
|
|
|
-#endif /* TRACE_LEVEL >= 2 */
|
|
|
-
|
|
|
-#if TRACE_LEVEL >= 3
|
|
|
-/** Function for Level 3 trace messages */
|
|
|
-#define TRACE_3(...) fprintf(stderr, __VA_ARGS__)
|
|
|
-#else /* TRACE_LEVEL >= 3 */
|
|
|
-/** Function for Level 3 trace messages */
|
|
|
-#define TRACE_3(...) /* do nothing */
|
|
|
-#endif /* TRACE_LEVEL >= 3 */
|
|
|
-
|
|
|
-#endif /* TRACE_H */
|
|
|
+#ifndef PARSE_ENV
|
|
|
+/** Debug file descriptor */
|
|
|
+#define DBG_FD stderr
|
|
|
+#else /* PARSE_ENV */
|
|
|
+/** Debug file descriptor macro */
|
|
|
+#define DBG_FD dbg_fd
|
|
|
+/** Debug file descriptor */
|
|
|
+FILE* dbg_fd;
|
|
|
+#endif /* PARSE_ENV */
|
|
|
+
|
|
|
+/** Function for debug trace messages */
|
|
|
+#define DBG_TRACE(...) fprintf(DBG_FD, __VA_ARGS__)
|
|
|
+
|
|
|
+#else /* WITH_DEBUG */
|
|
|
+
|
|
|
+/** Function for debug trace messages */
|
|
|
+#define DBG_TRACE(...) /* do nothing */
|
|
|
+
|
|
|
+#endif /* WITH_DEBUG */
|
|
|
+
|
|
|
+#endif /* _DMMLIB_TRACE_H_ */
|