aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/debug_trace.h
blob: 1266ac6a760cb4d93248e9cc45913f5b7cba0658 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef LITMUS_DEBUG_TRACE_H
#define LITMUS_DEBUG_TRACE_H

#ifdef CONFIG_SCHED_DEBUG_TRACE
void sched_trace_log_message(const char* fmt, ...);
void dump_trace_buffer(int max);
#else

#define sched_trace_log_message(fmt, ...)

#endif

extern atomic_t __log_seq_no;

#ifdef CONFIG_SCHED_DEBUG_TRACE_CALLER
#define TRACE_PREFIX "%d P%d [%s@%s:%d]: "
#define TRACE_ARGS  atomic_add_return(1, &__log_seq_no),	\
		raw_smp_processor_id(),				\
		__FUNCTION__, __FILE__, __LINE__
#else
#define TRACE_PREFIX "%d P%d: "
#define TRACE_ARGS  atomic_add_return(1, &__log_seq_no), \
		raw_smp_processor_id()
#endif

#define TRACE(fmt, args...)						\
	sched_trace_log_message(TRACE_PREFIX fmt,			\
				TRACE_ARGS,  ## args)

#define TRACE_TASK(t, fmt, args...)			\
	TRACE("(%s/%d:%d) " fmt,			 \
	      t ? (t)->comm : "null",			 \
	      t ? (t)->pid : 0,				 \
	      t ? (t)->rt_param.job_params.job_no : 0,	 \
	      ##args)

#define TRACE_CUR(fmt, args...) \
	TRACE_TASK(current, fmt, ## args)

#endif