aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-05-06 21:18:33 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-05-06 21:18:33 -0400
commitdb7b8b961c72c9ab079728dea0beb682ba78d56b (patch)
treec7901ae8c478d26c85bd07167414c34bb6b23ed1
parent41bba723584060d4045eaa133d6cde5f83c10f3a (diff)
Add task_exit event that records max exec time under color plugin.
-rw-r--r--include/litmus/rt_param.h3
-rw-r--r--include/litmus/sched_trace.h19
-rw-r--r--include/trace/events/litmus.h23
-rw-r--r--litmus/sched_color.c10
-rw-r--r--litmus/sched_task_trace.c16
5 files changed, 70 insertions, 1 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index ec35c220abe4..2a4b99be636b 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -226,8 +226,11 @@ struct rt_param {
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 228
229#ifdef CONFIG_PLUGIN_COLOR
230 lt_t max_exec_time;
229 struct color_ctrl_page *color_ctrl_page; 231 struct color_ctrl_page *color_ctrl_page;
230 struct dgl_group_req *req; 232 struct dgl_group_req *req;
233#endif
231}; 234};
232 235
233/* Possible RT flags */ 236/* Possible RT flags */
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h
index 0773aebcae16..8f61f3fa486b 100644
--- a/include/litmus/sched_trace.h
+++ b/include/litmus/sched_trace.h
@@ -81,6 +81,11 @@ struct st_sys_release_data {
81 u64 release; 81 u64 release;
82}; 82};
83 83
84struct st_task_exit_data {
85 u64 max_exec_time;
86 u64 __unused;
87};
88
84#define DATA(x) struct st_ ## x ## _data x; 89#define DATA(x) struct st_ ## x ## _data x;
85 90
86typedef enum { 91typedef enum {
@@ -95,7 +100,8 @@ typedef enum {
95 ST_BLOCK, 100 ST_BLOCK,
96 ST_RESUME, 101 ST_RESUME,
97 ST_ACTION, 102 ST_ACTION,
98 ST_SYS_RELEASE 103 ST_SYS_RELEASE,
104 ST_TASK_EXIT,
99} st_event_record_type_t; 105} st_event_record_type_t;
100 106
101struct st_event_record { 107struct st_event_record {
@@ -114,6 +120,7 @@ struct st_event_record {
114 DATA(resume); 120 DATA(resume);
115 DATA(action); 121 DATA(action);
116 DATA(sys_release); 122 DATA(sys_release);
123 DATA(task_exit);
117 } data; 124 } data;
118}; 125};
119 126
@@ -155,6 +162,8 @@ feather_callback void do_sched_trace_action(unsigned long id,
155 unsigned long action); 162 unsigned long action);
156feather_callback void do_sched_trace_sys_release(unsigned long id, 163feather_callback void do_sched_trace_sys_release(unsigned long id,
157 lt_t* start); 164 lt_t* start);
165feather_callback void do_sched_trace_task_exit(unsigned long id,
166 struct task_struct* task);
158 167
159#endif 168#endif
160 169
@@ -180,6 +189,7 @@ feather_callback void do_sched_trace_sys_release(unsigned long id,
180#define trace_litmus_task_block(t, i) 189#define trace_litmus_task_block(t, i)
181#define trace_litmus_task_resume(t, i) 190#define trace_litmus_task_resume(t, i)
182#define trace_litmus_sys_release(start) 191#define trace_litmus_sys_release(start)
192#define trace_litmus_task_exit(t)
183 193
184#define trace_litmus_resource_acquire(t, i); 194#define trace_litmus_resource_acquire(t, i);
185#define trace_litmus_resource_release(t, i); 195#define trace_litmus_resource_release(t, i);
@@ -264,6 +274,13 @@ feather_callback void do_sched_trace_sys_release(unsigned long id,
264 trace_litmus_sys_release(when); \ 274 trace_litmus_sys_release(when); \
265 } while (0) 275 } while (0)
266 276
277#define sched_trace_task_exit(t) \
278 do { \
279 SCHED_TRACE(SCHED_TRACE_BASE_ID + 11, \
280 do_sched_trace_task_exit, t); \
281 trace_litmus_task_exit(t); \
282 } while (0)
283
267#define QT_START lt_t _qt_start = litmus_clock() 284#define QT_START lt_t _qt_start = litmus_clock()
268#define QT_END \ 285#define QT_END \
269 sched_trace_log_message("%d P%d [%s@%s:%d]: Took %llu\n\n", \ 286 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 136a80db54a4..c767f4ffef69 100644
--- a/include/trace/events/litmus.h
+++ b/include/trace/events/litmus.h
@@ -284,6 +284,29 @@ TRACE_EVENT(litmus_sys_release,
284); 284);
285 285
286/* 286/*
287 * Trace task exit
288 */
289TRACE_EVENT(litmus_task_exit,
290
291 TP_PROTO(struct task_struct *t),
292
293 TP_ARGS(t),
294
295 TP_STRUCT__entry(
296 __field( pid_t, pid )
297 __field( unsigned long long, max_exec_time )
298 ),
299
300 TP_fast_assign(
301 __entry->pid = t ? t->pid : 0;
302#ifdef CONFIG_PLUGIN_COLOR
303 __entry->max_exec_time = t ? t->rt_param.max_exec_time : 0;
304 ),
305
306 TP_printk("(%u) exit\n", __entry->pid)
307);
308
309/*
287 * Containers 310 * Containers
288 */ 311 */
289TRACE_EVENT(litmus_container_param, 312TRACE_EVENT(litmus_container_param,
diff --git a/litmus/sched_color.c b/litmus/sched_color.c
index 29516e948749..0448983e13ce 100644
--- a/litmus/sched_color.c
+++ b/litmus/sched_color.c
@@ -205,6 +205,7 @@ static void link(struct rt_server *server, struct task_struct *task)
205static void job_completion(struct rt_server *server) 205static void job_completion(struct rt_server *server)
206{ 206{
207 struct task_struct *t = server->linked; 207 struct task_struct *t = server->linked;
208 lt_t et;
208 209
209 TRACE_TASK(t, "Job completed\n"); 210 TRACE_TASK(t, "Job completed\n");
210 if (is_server(t)) 211 if (is_server(t))
@@ -212,6 +213,13 @@ static void job_completion(struct rt_server *server)
212 else 213 else
213 sched_trace_task_completion(t, 0); 214 sched_trace_task_completion(t, 0);
214 215
216 if (1 < get_rt_job(t)) {
217 /* our releases happen at the second job */
218 et = get_exec_time(t);
219 if (et > tsk_rt(t)->max_exec_time)
220 tsk_rt(t)->max_exec_time = et;
221 }
222
215 unlink(server); 223 unlink(server);
216 set_rt_flags(t, RT_F_SLEEP); 224 set_rt_flags(t, RT_F_SLEEP);
217 prepare_for_next_period(t); 225 prepare_for_next_period(t);
@@ -525,6 +533,8 @@ static void color_task_new(struct task_struct *t, int on_rq, int running)
525 dgl_group_req_init(&group_lock, req); 533 dgl_group_req_init(&group_lock, req);
526 tsk_rt(t)->req = req; 534 tsk_rt(t)->req = req;
527 535
536 tsk_rt(t)->max_exec_time = 0;
537
528 /* Fill request */ 538 /* Fill request */
529 if (tsk_rt(t)->color_ctrl_page) { 539 if (tsk_rt(t)->color_ctrl_page) {
530 colors = tsk_rt(t)->color_ctrl_page->colors; 540 colors = tsk_rt(t)->color_ctrl_page->colors;
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c
index 5ef8d09ab41f..636ea038f403 100644
--- a/litmus/sched_task_trace.c
+++ b/litmus/sched_task_trace.c
@@ -226,6 +226,22 @@ feather_callback void do_sched_trace_sys_release(unsigned long id,
226 } 226 }
227} 227}
228 228
229feather_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#ifdef CONFIG_PLUGIN_COLOR
234 const lt_t max_exec_time = tsk_rt(t)->max_exec_time;
235#else
236 const lt_t max_exec_time = 0;
237#endif
238 struct st_event_record *rec = get_record(ST_TASK_EXIT, t);
239 if (rec) {
240 rec->data.task_exit.max_exec_time = max_exec_time;
241 put_record(rec);
242 }
243}
244
229feather_callback void do_sched_trace_action(unsigned long id, 245feather_callback void do_sched_trace_action(unsigned long id,
230 unsigned long _task, 246 unsigned long _task,
231 unsigned long action) 247 unsigned long action)