diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-06-23 10:29:07 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-08-07 03:46:42 -0400 |
commit | 49fa66f74b78c9b08d2ba038db409b5bbde11fab (patch) | |
tree | c77f254cb3143baae03f4d6b8c67e7c47b4ba64a /include | |
parent | 05ad941dfa83599208ee11b67c49ad54c4f3b78a (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.h | 40 |
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 | ||
5 | void sched_trace_log_message(const char* fmt, ...); | ||
6 | void dump_trace_buffer(int max); | ||
7 | #else | ||
8 | |||
9 | #define sched_trace_log_message(fmt, ...) | ||
10 | |||
11 | #endif | ||
12 | |||
13 | extern 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 | ||