diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2012-05-06 21:18:33 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-09-27 15:25:58 -0400 |
commit | 45d0f315ec64bdac3ba0723be07e83b7df7652f8 (patch) | |
tree | e18a178a5ddf40995d6414ca4b6a2b9522c97b0f | |
parent | 63fabd87c18d0da2d727ae79ae864d6064f9e7e0 (diff) |
Add task_exit event that records max exec time under color plugin.
Conflicts:
include/litmus/rt_param.h
litmus/sched_color.c
-rw-r--r-- | include/litmus/rt_param.h | 2 | ||||
-rw-r--r-- | include/litmus/sched_trace.h | 19 | ||||
-rw-r--r-- | include/trace/events/litmus.h | 22 | ||||
-rw-r--r-- | litmus/sched_task_trace.c | 13 |
4 files changed, 55 insertions, 1 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index fac939dbd33a..d84248828cf1 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -225,6 +225,8 @@ struct rt_param { | |||
225 | 225 | ||
226 | /* Pointer to the page shared between userspace and kernel. */ | 226 | /* Pointer to the page shared between userspace and kernel. */ |
227 | struct control_page * ctrl_page; | 227 | struct control_page * ctrl_page; |
228 | |||
229 | lt_t max_exec_time; | ||
228 | }; | 230 | }; |
229 | 231 | ||
230 | /* Possible RT flags */ | 232 | /* Possible RT flags */ |
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index adc223e9c8ab..098df0653172 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
@@ -80,6 +80,11 @@ struct st_sys_release_data { | |||
80 | u64 release; | 80 | u64 release; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | struct st_task_exit_data { | ||
84 | u64 max_exec_time; | ||
85 | u64 __unused; | ||
86 | }; | ||
87 | |||
83 | #define DATA(x) struct st_ ## x ## _data x; | 88 | #define DATA(x) struct st_ ## x ## _data x; |
84 | 89 | ||
85 | typedef enum { | 90 | typedef enum { |
@@ -94,7 +99,8 @@ typedef enum { | |||
94 | ST_BLOCK, | 99 | ST_BLOCK, |
95 | ST_RESUME, | 100 | ST_RESUME, |
96 | ST_ACTION, | 101 | ST_ACTION, |
97 | ST_SYS_RELEASE | 102 | ST_SYS_RELEASE, |
103 | ST_TASK_EXIT, | ||
98 | } st_event_record_type_t; | 104 | } st_event_record_type_t; |
99 | 105 | ||
100 | struct st_event_record { | 106 | struct st_event_record { |
@@ -113,6 +119,7 @@ struct st_event_record { | |||
113 | DATA(resume); | 119 | DATA(resume); |
114 | DATA(action); | 120 | DATA(action); |
115 | DATA(sys_release); | 121 | DATA(sys_release); |
122 | DATA(task_exit); | ||
116 | } data; | 123 | } data; |
117 | }; | 124 | }; |
118 | 125 | ||
@@ -154,6 +161,8 @@ feather_callback void do_sched_trace_action(unsigned long id, | |||
154 | unsigned long action); | 161 | unsigned long action); |
155 | feather_callback void do_sched_trace_sys_release(unsigned long id, | 162 | feather_callback void do_sched_trace_sys_release(unsigned long id, |
156 | lt_t* start); | 163 | lt_t* start); |
164 | feather_callback void do_sched_trace_task_exit(unsigned long id, | ||
165 | struct task_struct* task); | ||
157 | 166 | ||
158 | #endif | 167 | #endif |
159 | 168 | ||
@@ -179,6 +188,7 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
179 | #define trace_litmus_task_block(t) | 188 | #define trace_litmus_task_block(t) |
180 | #define trace_litmus_task_resume(t) | 189 | #define trace_litmus_task_resume(t) |
181 | #define trace_litmus_sys_release(start) | 190 | #define trace_litmus_sys_release(start) |
191 | #define trace_litmus_task_exit(t) | ||
182 | 192 | ||
183 | #define trace_litmus_container_param(cid, name) | 193 | #define trace_litmus_container_param(cid, name) |
184 | #define trace_litmus_server_param(sid, cid, wcet, time) | 194 | #define trace_litmus_server_param(sid, cid, wcet, time) |
@@ -275,6 +285,13 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
275 | trace_litmus_sys_release(when); \ | 285 | trace_litmus_sys_release(when); \ |
276 | } while (0) | 286 | } while (0) |
277 | 287 | ||
288 | #define sched_trace_task_exit(t) \ | ||
289 | do { \ | ||
290 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 11, \ | ||
291 | do_sched_trace_task_exit, t); \ | ||
292 | trace_litmus_task_exit(t); \ | ||
293 | } while (0) | ||
294 | |||
278 | #define QT_START lt_t _qt_start = litmus_clock() | 295 | #define QT_START lt_t _qt_start = litmus_clock() |
279 | #define QT_END \ | 296 | #define QT_END \ |
280 | sched_trace_log_message("%d P%d [%s@%s:%d]: Took %llu\n\n", \ | 297 | sched_trace_log_message("%d P%d [%s@%s:%d]: Took %llu\n\n", \ |
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h index b3a8f166e65f..c3a92f8ec6ef 100644 --- a/include/trace/events/litmus.h +++ b/include/trace/events/litmus.h | |||
@@ -275,6 +275,28 @@ TRACE_EVENT(litmus_sys_release, | |||
275 | ); | 275 | ); |
276 | 276 | ||
277 | /* | 277 | /* |
278 | * Trace task exit | ||
279 | */ | ||
280 | TRACE_EVENT(litmus_task_exit, | ||
281 | |||
282 | TP_PROTO(struct task_struct *t), | ||
283 | |||
284 | TP_ARGS(t), | ||
285 | |||
286 | TP_STRUCT__entry( | ||
287 | __field( pid_t, pid ) | ||
288 | __field( unsigned long long, max_exec_time ) | ||
289 | ), | ||
290 | |||
291 | TP_fast_assign( | ||
292 | __entry->pid = t ? t->pid : 0; | ||
293 | __entry->max_exec_time = t ? t->rt_param.max_exec_time : 0; | ||
294 | ), | ||
295 | |||
296 | TP_printk("(%u) exit\n", __entry->pid) | ||
297 | ); | ||
298 | |||
299 | /* | ||
278 | * Containers | 300 | * Containers |
279 | */ | 301 | */ |
280 | TRACE_EVENT(litmus_container_param, | 302 | TRACE_EVENT(litmus_container_param, |
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c index 5ef8d09ab41f..d2ece6b764b0 100644 --- a/litmus/sched_task_trace.c +++ b/litmus/sched_task_trace.c | |||
@@ -226,6 +226,19 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | feather_callback void do_sched_trace_task_exit(unsigned long id, | ||
230 | unsigned long _task) | ||
231 | { | ||
232 | struct task_struct *t = (struct task_struct*) _task; | ||
233 | const lt_t max_exec_time = tsk_rt(t)->max_exec_time; | ||
234 | |||
235 | struct st_event_record *rec = get_record(ST_TASK_EXIT, t); | ||
236 | if (rec) { | ||
237 | rec->data.task_exit.max_exec_time = max_exec_time; | ||
238 | put_record(rec); | ||
239 | } | ||
240 | } | ||
241 | |||
229 | feather_callback void do_sched_trace_action(unsigned long id, | 242 | feather_callback void do_sched_trace_action(unsigned long id, |
230 | unsigned long _task, | 243 | unsigned long _task, |
231 | unsigned long action) | 244 | unsigned long action) |