aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/debug_trace.h
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-11-08 15:02:09 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-11-11 17:57:42 -0500
commit34310fd7dbc3ad98d8e7cafa4f872ba71ca00860 (patch)
tree31ddcaa124430c37ccb5e2f4cb0a69c37ad885ba /include/litmus/debug_trace.h
parentc6182ba4a548baf0d1238d0df54e7d38ed299c3e (diff)
Split out TRACE() from litmus.h and cleanup some includes
The TRACE() functionality doesn't need all of litmus.h. Currently, it's impossible to use TRACE() in sched.h due to a circular dependency. This patch moves TRACE() and friends to litmus/sched_debug.h, which can be included in sched.h. While at it, also fix some minor include ugliness that was revealed by this change.
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