aboutsummaryrefslogblamecommitdiffstats
path: root/include/litmus/debug_trace.h
blob: 5ca88dec31a5984c48db50f796bb6626ffb77595 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                   










                                                                 
                                                                         

                                                                         
 

                                                         
                                       



                                         
      
#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)->comm, (t)->pid,	\
	      get_user_job(t),  ##args)

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

#endif