diff options
author | Andrea Bastoni <bastoni@sprg.uniroma2.it> | 2012-02-11 15:41:19 -0500 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-03-30 09:39:33 -0400 |
commit | 26bafa3b7880a323d83b8ea71bdb8e2118a5cba0 (patch) | |
tree | 0ca24b2d23aa5588bbe0f14ad50318d6da3479b6 /include/trace | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Add kernel-style events for sched_trace_XXX() functions
Enable kernel-style events (tracepoint) for Litmus. Litmus events
trace the same functions as the sched_trace_XXX(), but can be
enabled independently.
So, why another tracing infrastructure then:
- Litmus tracepoints can be recorded and analyzed together (single
time reference) with all other kernel tracing events (e.g.,
sched:sched_switch, etc.). It's easier to correlate the effects
of kernel events on litmus tasks.
- It enables a quick way to visualize and process schedule traces
using trace-cmd utility and kernelshark visualizer.
Kernelshark lacks unit-trace's schedule-correctness checks, but
it enables a fast view of schedule traces and it has several
filtering options (for all kernel events, not only Litmus').
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/events/litmus.h | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h new file mode 100644 index 000000000000..0fffcee02be0 --- /dev/null +++ b/include/trace/events/litmus.h | |||
@@ -0,0 +1,231 @@ | |||
1 | /* | ||
2 | * LITMUS^RT kernel style scheduling tracepoints | ||
3 | */ | ||
4 | #undef TRACE_SYSTEM | ||
5 | #define TRACE_SYSTEM litmus | ||
6 | |||
7 | #if !defined(_SCHED_TASK_TRACEPOINT_H) || defined(TRACE_HEADER_MULTI_READ) | ||
8 | #define _SCHED_TASK_TRACEPOINT_H | ||
9 | |||
10 | #include <linux/tracepoint.h> | ||
11 | |||
12 | #include <litmus/litmus.h> | ||
13 | #include <litmus/rt_param.h> | ||
14 | |||
15 | /* | ||
16 | * Tracing task admission | ||
17 | */ | ||
18 | TRACE_EVENT(litmus_task_param, | ||
19 | |||
20 | TP_PROTO(struct task_struct *t), | ||
21 | |||
22 | TP_ARGS(t), | ||
23 | |||
24 | TP_STRUCT__entry( | ||
25 | __field( pid_t, pid ) | ||
26 | __field( unsigned int, job ) | ||
27 | __field( lt_t, wcet ) | ||
28 | __field( lt_t, period ) | ||
29 | __field( lt_t, phase ) | ||
30 | __field( int, partition ) | ||
31 | ), | ||
32 | |||
33 | TP_fast_assign( | ||
34 | __entry->pid = t ? t->pid : 0; | ||
35 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
36 | __entry->wcet = get_exec_cost(t); | ||
37 | __entry->period = get_rt_period(t); | ||
38 | __entry->phase = get_rt_phase(t); | ||
39 | __entry->partition = get_partition(t); | ||
40 | ), | ||
41 | |||
42 | TP_printk("period(%d, %Lu).\nwcet(%d, %Lu).\n", | ||
43 | __entry->pid, __entry->period, | ||
44 | __entry->pid, __entry->wcet) | ||
45 | ); | ||
46 | |||
47 | /* | ||
48 | * Tracing jobs release | ||
49 | */ | ||
50 | TRACE_EVENT(litmus_task_release, | ||
51 | |||
52 | TP_PROTO(struct task_struct *t), | ||
53 | |||
54 | TP_ARGS(t), | ||
55 | |||
56 | TP_STRUCT__entry( | ||
57 | __field( pid_t, pid ) | ||
58 | __field( unsigned int, job ) | ||
59 | __field( lt_t, release ) | ||
60 | __field( lt_t, deadline ) | ||
61 | ), | ||
62 | |||
63 | TP_fast_assign( | ||
64 | __entry->pid = t ? t->pid : 0; | ||
65 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
66 | __entry->release = get_release(t); | ||
67 | __entry->deadline = get_deadline(t); | ||
68 | ), | ||
69 | |||
70 | TP_printk("release(job(%u, %u)): %Lu\ndeadline(job(%u, %u)): %Lu\n", | ||
71 | __entry->pid, __entry->job, __entry->release, | ||
72 | __entry->pid, __entry->job, __entry->deadline) | ||
73 | ); | ||
74 | |||
75 | /* | ||
76 | * Tracepoint for switching to new task | ||
77 | */ | ||
78 | TRACE_EVENT(litmus_switch_to, | ||
79 | |||
80 | TP_PROTO(struct task_struct *t), | ||
81 | |||
82 | TP_ARGS(t), | ||
83 | |||
84 | TP_STRUCT__entry( | ||
85 | __field( pid_t, pid ) | ||
86 | __field( unsigned int, job ) | ||
87 | __field( lt_t, when ) | ||
88 | __field( lt_t, exec_time ) | ||
89 | ), | ||
90 | |||
91 | TP_fast_assign( | ||
92 | __entry->pid = is_realtime(t) ? t->pid : 0; | ||
93 | __entry->job = is_realtime(t) ? t->rt_param.job_params.job_no : 0; | ||
94 | __entry->when = litmus_clock(); | ||
95 | __entry->exec_time = get_exec_time(t); | ||
96 | ), | ||
97 | |||
98 | TP_printk("switch_to(job(%u, %u)): %Lu (exec: %Lu)\n", | ||
99 | __entry->pid, __entry->job, | ||
100 | __entry->when, __entry->exec_time) | ||
101 | ); | ||
102 | |||
103 | /* | ||
104 | * Tracepoint for switching away previous task | ||
105 | */ | ||
106 | TRACE_EVENT(litmus_switch_away, | ||
107 | |||
108 | TP_PROTO(struct task_struct *t), | ||
109 | |||
110 | TP_ARGS(t), | ||
111 | |||
112 | TP_STRUCT__entry( | ||
113 | __field( pid_t, pid ) | ||
114 | __field( unsigned int, job ) | ||
115 | __field( lt_t, when ) | ||
116 | __field( lt_t, exec_time ) | ||
117 | ), | ||
118 | |||
119 | TP_fast_assign( | ||
120 | __entry->pid = is_realtime(t) ? t->pid : 0; | ||
121 | __entry->job = is_realtime(t) ? t->rt_param.job_params.job_no : 0; | ||
122 | __entry->when = litmus_clock(); | ||
123 | __entry->exec_time = get_exec_time(t); | ||
124 | ), | ||
125 | |||
126 | TP_printk("switch_away(job(%u, %u)): %Lu (exec: %Lu)\n", | ||
127 | __entry->pid, __entry->job, | ||
128 | __entry->when, __entry->exec_time) | ||
129 | ); | ||
130 | |||
131 | /* | ||
132 | * Tracing jobs completion | ||
133 | */ | ||
134 | TRACE_EVENT(litmus_task_completion, | ||
135 | |||
136 | TP_PROTO(struct task_struct *t, unsigned long forced), | ||
137 | |||
138 | TP_ARGS(t, forced), | ||
139 | |||
140 | TP_STRUCT__entry( | ||
141 | __field( pid_t, pid ) | ||
142 | __field( unsigned int, job ) | ||
143 | __field( lt_t, when ) | ||
144 | __field( unsigned long, forced ) | ||
145 | ), | ||
146 | |||
147 | TP_fast_assign( | ||
148 | __entry->pid = t ? t->pid : 0; | ||
149 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
150 | __entry->when = litmus_clock(); | ||
151 | __entry->forced = forced; | ||
152 | ), | ||
153 | |||
154 | TP_printk("completed(job(%u, %u)): %Lu (forced: %lu)\n", | ||
155 | __entry->pid, __entry->job, | ||
156 | __entry->when, __entry->forced) | ||
157 | ); | ||
158 | |||
159 | /* | ||
160 | * Trace blocking tasks. | ||
161 | */ | ||
162 | TRACE_EVENT(litmus_task_block, | ||
163 | |||
164 | TP_PROTO(struct task_struct *t), | ||
165 | |||
166 | TP_ARGS(t), | ||
167 | |||
168 | TP_STRUCT__entry( | ||
169 | __field( pid_t, pid ) | ||
170 | __field( lt_t, when ) | ||
171 | ), | ||
172 | |||
173 | TP_fast_assign( | ||
174 | __entry->pid = t ? t->pid : 0; | ||
175 | __entry->when = litmus_clock(); | ||
176 | ), | ||
177 | |||
178 | TP_printk("(%u) blocks: %Lu\n", __entry->pid, __entry->when) | ||
179 | ); | ||
180 | |||
181 | /* | ||
182 | * Tracing jobs resume | ||
183 | */ | ||
184 | TRACE_EVENT(litmus_task_resume, | ||
185 | |||
186 | TP_PROTO(struct task_struct *t), | ||
187 | |||
188 | TP_ARGS(t), | ||
189 | |||
190 | TP_STRUCT__entry( | ||
191 | __field( pid_t, pid ) | ||
192 | __field( unsigned int, job ) | ||
193 | __field( lt_t, when ) | ||
194 | ), | ||
195 | |||
196 | TP_fast_assign( | ||
197 | __entry->pid = t ? t->pid : 0; | ||
198 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
199 | __entry->when = litmus_clock(); | ||
200 | ), | ||
201 | |||
202 | TP_printk("resume(job(%u, %u)): %Lu\n", | ||
203 | __entry->pid, __entry->job, __entry->when) | ||
204 | ); | ||
205 | |||
206 | /* | ||
207 | * Trace synchronous release | ||
208 | */ | ||
209 | TRACE_EVENT(litmus_sys_release, | ||
210 | |||
211 | TP_PROTO(lt_t *start), | ||
212 | |||
213 | TP_ARGS(start), | ||
214 | |||
215 | TP_STRUCT__entry( | ||
216 | __field( lt_t, rel ) | ||
217 | __field( lt_t, when ) | ||
218 | ), | ||
219 | |||
220 | TP_fast_assign( | ||
221 | __entry->rel = *start; | ||
222 | __entry->when = litmus_clock(); | ||
223 | ), | ||
224 | |||
225 | TP_printk("SynRelease(%Lu) at %Lu\n", __entry->rel, __entry->when) | ||
226 | ); | ||
227 | |||
228 | #endif /* _SCHED_TASK_TRACEPOINT_H */ | ||
229 | |||
230 | /* Must stay outside the protection */ | ||
231 | #include <trace/define_trace.h> | ||