aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-06-23 10:29:07 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2014-10-21 10:00:35 -0400
commit7fb0ac2758b6e277de7bd753fdbe8596048d156c (patch)
treeea31047e3456815649999a624dc75dec756b3ce0 /include
parent74a89132e046e7a35f16f6eab9c6884679d48f27 (diff)
Add TRACE() debug tracing support
This patch adds the infrastructure for the TRACE() debug macro.
Diffstat (limited to 'include')
-rw-r--r--include/litmus/debug_trace.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/litmus/debug_trace.h b/include/litmus/debug_trace.h
new file mode 100644
index 000000000000..1266ac6a760c
--- /dev/null
+++ b/include/litmus/debug_trace.h
@@ -0,0 +1,40 @@
1#ifndef LITMUS_DEBUG_TRACE_H
2#define LITMUS_DEBUG_TRACE_H
3
4#ifdef CONFIG_SCHED_DEBUG_TRACE
5void sched_trace_log_message(const char* fmt, ...);
6void dump_trace_buffer(int max);
7#else
8
9#define sched_trace_log_message(fmt, ...)
10
11#endif
12
13extern atomic_t __log_seq_no;
14
15#ifdef CONFIG_SCHED_DEBUG_TRACE_CALLER
16#define TRACE_PREFIX "%d P%d [%s@%s:%d]: "
17#define TRACE_ARGS atomic_add_return(1, &__log_seq_no), \
18 raw_smp_processor_id(), \
19 __FUNCTION__, __FILE__, __LINE__
20#else
21#define TRACE_PREFIX "%d P%d: "
22#define TRACE_ARGS atomic_add_return(1, &__log_seq_no), \
23 raw_smp_processor_id()
24#endif
25
26#define TRACE(fmt, args...) \
27 sched_trace_log_message(TRACE_PREFIX fmt, \
28 TRACE_ARGS, ## args)
29
30#define TRACE_TASK(t, fmt, args...) \
31 TRACE("(%s/%d:%d) " fmt, \
32 t ? (t)->comm : "null", \
33 t ? (t)->pid : 0, \
34 t ? (t)->rt_param.job_params.job_no : 0, \
35 ##args)
36
37#define TRACE_CUR(fmt, args...) \
38 TRACE_TASK(current, fmt, ## args)
39
40#endif