From 2f41251f9febad2e54fa338ea63a62818970af0c Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Fri, 18 Dec 2009 09:08:44 -0500 Subject: Test kernel tracing events capabilities Can events be applied to LITMUS code instead of sched_task_trace ? PROS: - architectural indipendency - easy porting on newer kernel version - lock free ring buffer implementation already there CONS: - need userspace tools conversion to slightly different format - is it possible to replicate all the previous functionalities? - only sched_trace_* functions can be implemented through events, TRACE() debugging features are still implemented in the old way (??? cannot we simply use the tracing features of the kernel for debugging purposes ????) --- include/trace/events/litmus.h | 147 ++++++++++++++++++++++++++++++++++++++++++ include/trace/events/sched.h | 3 + 2 files changed, 150 insertions(+) create mode 100644 include/trace/events/litmus.h (limited to 'include') diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h new file mode 100644 index 000000000000..e5216a8502c2 --- /dev/null +++ b/include/trace/events/litmus.h @@ -0,0 +1,147 @@ +/* + * LITMUS^RT scheduling events + * included from sched. + */ +#include +#include + +/* + * Tracing task admission + */ +TRACE_EVENT(litmus_task_param, + + TP_PROTO(struct task_struct *t), + + TP_ARGS(t), + + TP_STRUCT__entry( + __field( pid_t, pid ) + __field( unsigned int, job ) + __field( lt_t, wcet ) + __field( lt_t, period ) + __field( lt_t, phase ) + __field( int, partition ) + ), + + TP_fast_assign( + __entry->pid = t ? t->pid : 0; + __entry->job = t ? t->rt_param.job_params.job_no : 0; + __entry->wcet = get_exec_cost(t); + __entry->period = get_rt_period(t); + __entry->phase = get_rt_phase(t); + __entry->partition = get_partition(t); + ), + + TP_printk("period(%d, %Lu).\nwcet(%d, %Lu).\n", + __entry->pid, __entry->period, + __entry->pid, __entry->wcet) +); + +/* + * Tracing jobs release + */ +TRACE_EVENT(litmus_task_release, + + TP_PROTO(struct task_struct *t), + + TP_ARGS(t), + + TP_STRUCT__entry( + __field( pid_t, pid ) + __field( unsigned int, job ) + __field( lt_t, release ) + __field( lt_t, deadline ) + ), + + TP_fast_assign( + __entry->pid = t ? t->pid : 0; + __entry->job = t ? t->rt_param.job_params.job_no : 0; + __entry->release = get_release(t); + __entry->deadline = get_deadline(t); + ), + + TP_printk("released(job(%u, %u), %Lu).\ndeadline(job(%u, %u), %Lu).\n", + __entry->pid, __entry->job, __entry->release, + __entry->pid, __entry->job, __entry->deadline) +); + +/* + * Tracing jobs completion + */ +TRACE_EVENT(litmus_task_completion, + + TP_PROTO(struct task_struct *t, unsigned long forced), + + TP_ARGS(t, forced), + + TP_STRUCT__entry( + __field( pid_t, pid ) + __field( unsigned int, job ) + __field( lt_t, when ) + __field( unsigned long, forced ) + ), + + TP_fast_assign( + __entry->pid = t ? t->pid : 0; + __entry->job = t ? t->rt_param.job_params.job_no : 0; + __entry->when = litmus_clock(); + __entry->forced = forced; + ), + + TP_printk("completed(job(%u, %u), %Lu).\n", + __entry->pid, __entry->job, __entry->when) +); + +/* + * Tracing jobs resume + */ +TRACE_EVENT(litmus_task_resume, + + TP_PROTO(struct task_struct *t), + + TP_ARGS(t), + + TP_STRUCT__entry( + __field( pid_t, pid ) + __field( unsigned int, job ) + __field( lt_t, when ) + ), + + TP_fast_assign( + __entry->pid = t ? t->pid : 0; + __entry->job = t ? t->rt_param.job_params.job_no : 0; + __entry->when = litmus_clock(); + ), + + TP_printk("resumed(job(%u, %u), %Lu).\n", + __entry->pid, __entry->job, __entry->when) +); + +/* + * Tracepoint for switching away previous task + */ +TRACE_EVENT(litmus_switch_away, + + TP_PROTO(struct task_struct *t), + + TP_ARGS(t), + + TP_STRUCT__entry( + __field( pid_t, pid ) + __field( unsigned int, job ) + __field( lt_t, when ) + __field( lt_t, exec_time ) + ), + + TP_fast_assign( + __entry->pid = t ? t->pid : 0; + __entry->job = t ? t->rt_param.job_params.job_no : 0; + __entry->when = litmus_clock(); + __entry->exec_time = get_exec_time(t); + ), + + TP_printk("scheduled(job(%u, %u), %Lu, %Lu).\n", + __entry->pid, __entry->job, + __entry->when, __entry->exec_time) +); + diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 4069c43f4187..0e1d542ca961 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -472,6 +472,9 @@ TRACE_EVENT(sched_stat_iowait, (unsigned long long)__entry->delay) ); +/* include LITMUS^RT scheduling events */ +#include "./litmus.h" + #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ -- cgit v1.2.2