aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/debug_trace.h
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 07:18:46 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2017-05-26 17:12:24 -0400
commitf298dae81d90b00d47be0ccb94a47be1861b5bf1 (patch)
tree18d8e4da47f406521a11bee3a08403bd4bbed602 /include/litmus/debug_trace.h
parent561d64d1856868e056b7530cb08fd12a4043190a (diff)
Add TRACE() debug tracing support
This patch adds the infrastructure for the TRACE() debug macro. Conflicts: kernel/printk.c
Diffstat (limited to 'include/litmus/debug_trace.h')
-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