aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/debug_trace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/litmus/debug_trace.h')
-rw-r--r--include/litmus/debug_trace.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/litmus/debug_trace.h b/include/litmus/debug_trace.h
new file mode 100644
index 000000000000..0f99be01d569
--- /dev/null
+++ b/include/litmus/debug_trace.h
@@ -0,0 +1,37 @@
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#define TRACE(fmt, args...) \
16 sched_trace_log_message("%d P%d: " fmt, atomic_add_return(1, &__log_seq_no), \
17 raw_smp_processor_id(), ## args)
18
19#define TRACE_TASK(t, fmt, args...) \
20 TRACE("(%s/%d) " fmt, (t)->comm, (t)->pid, ##args)
21
22#define TRACE_CUR(fmt, args...) \
23 TRACE_TASK(current, fmt, ## args)
24
25#define TRACE_BUG_ON(cond) \
26 do { if (cond) TRACE("BUG_ON(%s) at %s:%d " \
27 "called from %p current=%s/%d state=%d " \
28 "flags=%x partition=%d cpu=%d rtflags=%d"\
29 " job=%u timeslice=%u\n", \
30 #cond, __FILE__, __LINE__, __builtin_return_address(0), current->comm, \
31 current->pid, current->state, current->flags, \
32 get_partition(current), smp_processor_id(), get_rt_flags(current), \
33 current->rt_param.job_params.job_no, \
34 current->rt.time_slice\
35 ); } while(0);
36
37#endif