aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-09-21 14:15:30 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2012-09-21 14:15:30 -0400
commit63fabd87c18d0da2d727ae79ae864d6064f9e7e0 (patch)
treed7cb2098190abd03adef74ad1bd507a76e5ff9c7
parente6f51fb826ce98d436f445aae4eb9e9dba1f30e8 (diff)
Initial commit
-rw-r--r--include/litmus/sched_trace.h66
-rw-r--r--include/trace/events/litmus.h232
-rw-r--r--include/trace/ftrace.h5
3 files changed, 271 insertions, 32 deletions
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h
index 82bde8241298..adc223e9c8ab 100644
--- a/include/litmus/sched_trace.h
+++ b/include/litmus/sched_trace.h
@@ -180,6 +180,13 @@ feather_callback void do_sched_trace_sys_release(unsigned long id,
180#define trace_litmus_task_resume(t) 180#define trace_litmus_task_resume(t)
181#define trace_litmus_sys_release(start) 181#define trace_litmus_sys_release(start)
182 182
183#define trace_litmus_container_param(cid, name)
184#define trace_litmus_server_param(sid, cid, wcet, time)
185#define trace_litmus_server_switch_to(sid, job, tid)
186#define trace_litmus_server_switch_away(sid, job, tid)
187#define trace_litmus_server_release(sid, job, release, deadline)
188#define trace_litmus_server_completion(sid, job)
189
183#endif 190#endif
184 191
185 192
@@ -226,18 +233,34 @@ feather_callback void do_sched_trace_sys_release(unsigned long id,
226 trace_litmus_task_completion(t, forced); \ 233 trace_litmus_task_completion(t, forced); \
227 } while (0) 234 } while (0)
228 235
229#define sched_trace_task_block(t) \ 236#define sched_trace_task_block_on(t, i) \
230 do { \ 237 do { \
231 SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, \ 238 SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, \
232 do_sched_trace_task_block, t); \ 239 do_sched_trace_task_block, t); \
233 trace_litmus_task_block(t); \ 240 trace_litmus_task_block(t, i); \
234 } while (0) 241 } while (0)
235 242
236#define sched_trace_task_resume(t) \ 243#define sched_trace_task_block(t) \
244 sched_trace_task_block_on(t, 0)
245
246#define sched_trace_task_resume_on(t, i) \
237 do { \ 247 do { \
238 SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, \ 248 SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, \
239 do_sched_trace_task_resume, t); \ 249 do_sched_trace_task_resume, t); \
240 trace_litmus_task_resume(t); \ 250 trace_litmus_task_resume(t, i); \
251 } while (0)
252
253#define sched_trace_task_resume(t) \
254 sched_trace_task_resume_on(t, 0)
255
256#define sched_trace_resource_acquire(t, i) \
257 do { \
258 trace_litmus_resource_acquire(t, i); \
259 } while (0)
260
261#define sched_trace_resource_released(t, i) \
262 do { \
263 trace_litmus_resource_released(t, i); \
241 } while (0) 264 } while (0)
242 265
243#define sched_trace_action(t, action) \ 266#define sched_trace_action(t, action) \
@@ -252,6 +275,41 @@ feather_callback void do_sched_trace_sys_release(unsigned long id,
252 trace_litmus_sys_release(when); \ 275 trace_litmus_sys_release(when); \
253 } while (0) 276 } while (0)
254 277
278#define QT_START lt_t _qt_start = litmus_clock()
279#define QT_END \
280 sched_trace_log_message("%d P%d [%s@%s:%d]: Took %llu\n\n", \
281 TRACE_ARGS, litmus_clock() - _qt_start)
282
283#define sched_trace_container_param(cid, name) \
284 do { \
285 trace_litmus_container_param(cid, name); \
286 } while (0)
287
288#define sched_trace_server_param(sid, cid, wcet, period) \
289 do { \
290 trace_litmus_server_param(sid, cid, wcet, period); \
291 } while(0)
292
293#define sched_trace_server_switch_to(sid, job, tid) \
294 do { \
295 trace_litmus_server_switch_to(sid, job, tid); \
296 } while(0)
297
298#define sched_trace_server_switch_away(sid, job, tid) \
299 do { \
300 trace_litmus_server_switch_away(sid, job, tid); \
301 } while (0)
302
303#define sched_trace_server_release(sid, job, rel, dead) \
304 do { \
305 trace_litmus_server_release(sid, job, rel, dead); \
306 } while (0)
307
308#define sched_trace_server_completion(sid, job) \
309 do { \
310 trace_litmus_server_completion(sid, job); \
311 } while (0)
312
255#define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ 313#define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */
256 314
257#endif /* __KERNEL__ */ 315#endif /* __KERNEL__ */
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h
index 0fffcee02be0..b3a8f166e65f 100644
--- a/include/trace/events/litmus.h
+++ b/include/trace/events/litmus.h
@@ -11,10 +11,6 @@
11 11
12#include <litmus/litmus.h> 12#include <litmus/litmus.h>
13#include <litmus/rt_param.h> 13#include <litmus/rt_param.h>
14
15/*
16 * Tracing task admission
17 */
18TRACE_EVENT(litmus_task_param, 14TRACE_EVENT(litmus_task_param,
19 15
20 TP_PROTO(struct task_struct *t), 16 TP_PROTO(struct task_struct *t),
@@ -24,9 +20,9 @@ TRACE_EVENT(litmus_task_param,
24 TP_STRUCT__entry( 20 TP_STRUCT__entry(
25 __field( pid_t, pid ) 21 __field( pid_t, pid )
26 __field( unsigned int, job ) 22 __field( unsigned int, job )
27 __field( lt_t, wcet ) 23 __field( unsigned long long, wcet )
28 __field( lt_t, period ) 24 __field( unsigned long long, period )
29 __field( lt_t, phase ) 25 __field( unsigned long long, phase )
30 __field( int, partition ) 26 __field( int, partition )
31 ), 27 ),
32 28
@@ -56,8 +52,8 @@ TRACE_EVENT(litmus_task_release,
56 TP_STRUCT__entry( 52 TP_STRUCT__entry(
57 __field( pid_t, pid ) 53 __field( pid_t, pid )
58 __field( unsigned int, job ) 54 __field( unsigned int, job )
59 __field( lt_t, release ) 55 __field( unsigned long long, release )
60 __field( lt_t, deadline ) 56 __field( unsigned long long, deadline )
61 ), 57 ),
62 58
63 TP_fast_assign( 59 TP_fast_assign(
@@ -84,8 +80,8 @@ TRACE_EVENT(litmus_switch_to,
84 TP_STRUCT__entry( 80 TP_STRUCT__entry(
85 __field( pid_t, pid ) 81 __field( pid_t, pid )
86 __field( unsigned int, job ) 82 __field( unsigned int, job )
87 __field( lt_t, when ) 83 __field( unsigned long long, when )
88 __field( lt_t, exec_time ) 84 __field( unsigned long long, exec_time )
89 ), 85 ),
90 86
91 TP_fast_assign( 87 TP_fast_assign(
@@ -112,8 +108,8 @@ TRACE_EVENT(litmus_switch_away,
112 TP_STRUCT__entry( 108 TP_STRUCT__entry(
113 __field( pid_t, pid ) 109 __field( pid_t, pid )
114 __field( unsigned int, job ) 110 __field( unsigned int, job )
115 __field( lt_t, when ) 111 __field( unsigned long long, when )
116 __field( lt_t, exec_time ) 112 __field( unsigned long long, exec_time )
117 ), 113 ),
118 114
119 TP_fast_assign( 115 TP_fast_assign(
@@ -140,7 +136,7 @@ TRACE_EVENT(litmus_task_completion,
140 TP_STRUCT__entry( 136 TP_STRUCT__entry(
141 __field( pid_t, pid ) 137 __field( pid_t, pid )
142 __field( unsigned int, job ) 138 __field( unsigned int, job )
143 __field( lt_t, when ) 139 __field( unsigned long long, when )
144 __field( unsigned long, forced ) 140 __field( unsigned long, forced )
145 ), 141 ),
146 142
@@ -161,21 +157,71 @@ TRACE_EVENT(litmus_task_completion,
161 */ 157 */
162TRACE_EVENT(litmus_task_block, 158TRACE_EVENT(litmus_task_block,
163 159
164 TP_PROTO(struct task_struct *t), 160 TP_PROTO(struct task_struct *t, int lid),
165 161
166 TP_ARGS(t), 162 TP_ARGS(t, lid),
167 163
168 TP_STRUCT__entry( 164 TP_STRUCT__entry(
169 __field( pid_t, pid ) 165 __field( pid_t, pid )
170 __field( lt_t, when ) 166 __field( int, lid )
167 __field( unsigned long long, when )
171 ), 168 ),
172 169
173 TP_fast_assign( 170 TP_fast_assign(
174 __entry->pid = t ? t->pid : 0; 171 __entry->pid = t ? t->pid : 0;
172 __entry->lid = lid;
175 __entry->when = litmus_clock(); 173 __entry->when = litmus_clock();
176 ), 174 ),
177 175
178 TP_printk("(%u) blocks: %Lu\n", __entry->pid, __entry->when) 176 TP_printk("(%u) blocks on %d: %Lu\n", __entry->pid,
177 __entry->lid, __entry->when)
178);
179
180/*
181 * Lock events
182 */
183TRACE_EVENT(litmus_resource_acquire,
184
185 TP_PROTO(struct task_struct *t, int lid),
186
187 TP_ARGS(t, lid),
188
189 TP_STRUCT__entry(
190 __field( pid_t, pid )
191 __field( int, lid )
192 __field( unsigned long long, when )
193 ),
194
195 TP_fast_assign(
196 __entry->pid = t ? t->pid : 0;
197 __entry->lid = lid;
198 __entry->when = litmus_clock();
199 ),
200
201 TP_printk("(%u) acquires %d: %Lu\n", __entry->pid,
202 __entry->lid, __entry->when)
203);
204
205TRACE_EVENT(litmus_resource_release,
206
207 TP_PROTO(struct task_struct *t, int lid),
208
209 TP_ARGS(t, lid),
210
211 TP_STRUCT__entry(
212 __field( pid_t, pid )
213 __field( int, lid )
214 __field( unsigned long long, when )
215 ),
216
217 TP_fast_assign(
218 __entry->pid = t ? t->pid : 0;
219 __entry->lid = lid;
220 __entry->when = litmus_clock();
221 ),
222
223 TP_printk("(%u) releases %d: %Lu\n", __entry->pid,
224 __entry->lid, __entry->when)
179); 225);
180 226
181/* 227/*
@@ -183,24 +229,27 @@ TRACE_EVENT(litmus_task_block,
183 */ 229 */
184TRACE_EVENT(litmus_task_resume, 230TRACE_EVENT(litmus_task_resume,
185 231
186 TP_PROTO(struct task_struct *t), 232 TP_PROTO(struct task_struct *t, int lid),
187 233
188 TP_ARGS(t), 234 TP_ARGS(t, lid),
189 235
190 TP_STRUCT__entry( 236 TP_STRUCT__entry(
191 __field( pid_t, pid ) 237 __field( pid_t, pid )
238 __field( int, lid )
192 __field( unsigned int, job ) 239 __field( unsigned int, job )
193 __field( lt_t, when ) 240 __field( unsigned long long, when )
194 ), 241 ),
195 242
196 TP_fast_assign( 243 TP_fast_assign(
197 __entry->pid = t ? t->pid : 0; 244 __entry->pid = t ? t->pid : 0;
198 __entry->job = t ? t->rt_param.job_params.job_no : 0; 245 __entry->job = t ? t->rt_param.job_params.job_no : 0;
199 __entry->when = litmus_clock(); 246 __entry->when = litmus_clock();
247 __entry->lid = lid;
200 ), 248 ),
201 249
202 TP_printk("resume(job(%u, %u)): %Lu\n", 250 TP_printk("resume(job(%u, %u)) on %d: %Lu\n",
203 __entry->pid, __entry->job, __entry->when) 251 __entry->pid, __entry->job,
252 __entry->lid, __entry->when)
204); 253);
205 254
206/* 255/*
@@ -208,13 +257,13 @@ TRACE_EVENT(litmus_task_resume,
208 */ 257 */
209TRACE_EVENT(litmus_sys_release, 258TRACE_EVENT(litmus_sys_release,
210 259
211 TP_PROTO(lt_t *start), 260 TP_PROTO(unsigned long long *start),
212 261
213 TP_ARGS(start), 262 TP_ARGS(start),
214 263
215 TP_STRUCT__entry( 264 TP_STRUCT__entry(
216 __field( lt_t, rel ) 265 __field( unsigned long long, rel )
217 __field( lt_t, when ) 266 __field( unsigned long long, when )
218 ), 267 ),
219 268
220 TP_fast_assign( 269 TP_fast_assign(
@@ -225,6 +274,137 @@ TRACE_EVENT(litmus_sys_release,
225 TP_printk("SynRelease(%Lu) at %Lu\n", __entry->rel, __entry->when) 274 TP_printk("SynRelease(%Lu) at %Lu\n", __entry->rel, __entry->when)
226); 275);
227 276
277/*
278 * Containers
279 */
280TRACE_EVENT(litmus_container_param,
281
282 TP_PROTO(int cid, const char *name),
283
284 TP_ARGS(cid, name),
285
286 TP_STRUCT__entry(
287 __field( int, cid )
288 __array( char, name, TASK_COMM_LEN )
289 ),
290
291 TP_fast_assign(
292 memcpy(__entry->name, name, TASK_COMM_LEN);
293 __entry->cid = cid;
294 ),
295
296 TP_printk("container, name: %s, id: %d\n", __entry->name, __entry->cid)
297);
298
299TRACE_EVENT(litmus_server_param,
300
301 TP_PROTO(int sid, int cid, unsigned long long wcet, unsigned long long period),
302
303 TP_ARGS(sid, cid, wcet, period),
304
305 TP_STRUCT__entry(
306 __field( int, sid )
307 __field( int, cid )
308 __field( unsigned long long, wcet )
309 __field( unsigned long long, period )
310 ),
311
312 TP_fast_assign(
313 __entry->cid = cid;
314 __entry->sid = sid;
315 __entry->wcet = wcet;
316 __entry->period = period;
317 ),
318
319 TP_printk("server(%llu, %llu), sid: %llu, cont: %llu\n",
320 __entry->wcet, __entry->period, __entry->sid, __entry->cid)
321);
322
323TRACE_EVENT(litmus_server_switch_to,
324
325 TP_PROTO(int sid, unsigned int job, int tid),
326
327 TP_ARGS(sid, job, tid),
328
329 TP_STRUCT__entry(
330 __field( int, sid)
331 __field( unsigned int, job)
332 __field( int, tid)
333 ),
334
335 TP_fast_assign(
336 __entry->sid = sid;
337 __entry->tid = tid;
338 __entry->job = job;
339 ),
340
341 TP_printk("switch_to(server(%d, %u)): %d\n", __entry->sid, __entry->job, __entry->tid)
342);
343
344TRACE_EVENT(litmus_server_switch_away,
345
346 TP_PROTO(int sid, unsigned int job, int tid),
347
348 TP_ARGS(sid, job, tid),
349
350 TP_STRUCT__entry(
351 __field( int, sid)
352 __field( unsigned int, job)
353 __field( int, tid)
354 ),
355
356 TP_fast_assign(
357 __entry->sid = sid;
358 __entry->tid = tid;
359 ),
360
361 TP_printk("switch_away(server(%d, %u)): %d\n", __entry->sid, __entry->job, __entry->tid)
362);
363
364TRACE_EVENT(litmus_server_release,
365
366 TP_PROTO(int sid, unsigned int job,
367 unsigned long long release,
368 unsigned long long deadline),
369
370 TP_ARGS(sid, job, release, deadline),
371
372 TP_STRUCT__entry(
373 __field( int, sid)
374 __field( unsigned int, job)
375 __field( unsigned long long, release)
376 __field( unsigned long long, deadline)
377 ),
378
379 TP_fast_assign(
380 __entry->sid = sid;
381 __entry->job = job;
382 __entry->release = release;
383 __entry->deadline = deadline;
384 ),
385
386 TP_printk("release(server(%d, %u)), release: %llu, deadline: %llu\n", __entry->sid, __entry->job, __entry->release, __entry->deadline)
387);
388
389TRACE_EVENT(litmus_server_completion,
390
391 TP_PROTO(int sid, int job),
392
393 TP_ARGS(sid, job),
394
395 TP_STRUCT__entry(
396 __field( int, sid)
397 __field( unsigned int, job)
398 ),
399
400 TP_fast_assign(
401 __entry->sid = sid;
402 __entry->job = job;
403 ),
404
405 TP_printk("completion(server(%d, %d))\n", __entry->sid, __entry->job)
406);
407
228#endif /* _SCHED_TASK_TRACEPOINT_H */ 408#endif /* _SCHED_TASK_TRACEPOINT_H */
229 409
230/* Must stay outside the protection */ 410/* Must stay outside the protection */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 533c49f48047..4d6f3474e8fa 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <linux/ftrace_event.h> 19#include <linux/ftrace_event.h>
20#include <litmus/litmus.h>
20 21
21/* 22/*
22 * DECLARE_EVENT_CLASS can be used to add a generic function 23 * DECLARE_EVENT_CLASS can be used to add a generic function
@@ -54,7 +55,7 @@
54#define __string(item, src) __dynamic_array(char, item, -1) 55#define __string(item, src) __dynamic_array(char, item, -1)
55 56
56#undef TP_STRUCT__entry 57#undef TP_STRUCT__entry
57#define TP_STRUCT__entry(args...) args 58#define TP_STRUCT__entry(args...) args __field( unsigned long long, __rt_ts )
58 59
59#undef DECLARE_EVENT_CLASS 60#undef DECLARE_EVENT_CLASS
60#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \ 61#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
@@ -507,7 +508,7 @@ static inline notrace int ftrace_get_offsets_##call( \
507 strcpy(__get_str(dst), src); 508 strcpy(__get_str(dst), src);
508 509
509#undef TP_fast_assign 510#undef TP_fast_assign
510#define TP_fast_assign(args...) args 511#define TP_fast_assign(args...) args; __entry->__rt_ts = litmus_clock();
511 512
512#undef TP_perf_assign 513#undef TP_perf_assign
513#define TP_perf_assign(args...) 514#define TP_perf_assign(args...)