diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-05-09 17:11:56 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-05-09 17:11:56 -0400 |
commit | 1fde4dd4de048d7fbfe3e1418f4a76c62423ad95 (patch) | |
tree | f77ee7cb43fb069f47a2cdd2281031fbc752fe64 | |
parent | a80dba56e2bc970b300b32ca3a8f4e911c18bbad (diff) |
Track tasks average execution time, drop in TASK_EXIT record
-rw-r--r-- | include/litmus/rt_param.h | 1 | ||||
-rw-r--r-- | include/litmus/sched_trace.h | 2 | ||||
-rw-r--r-- | litmus/jobs.c | 13 | ||||
-rw-r--r-- | litmus/sched_color.c | 1 | ||||
-rw-r--r-- | litmus/sched_task_trace.c | 4 |
5 files changed, 14 insertions, 7 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 2a4b99be636b..209a89d7b459 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -228,6 +228,7 @@ struct rt_param { | |||
228 | 228 | ||
229 | #ifdef CONFIG_PLUGIN_COLOR | 229 | #ifdef CONFIG_PLUGIN_COLOR |
230 | lt_t max_exec_time; | 230 | lt_t max_exec_time; |
231 | lt_t tot_exec_time; | ||
231 | struct color_ctrl_page *color_ctrl_page; | 232 | struct color_ctrl_page *color_ctrl_page; |
232 | struct dgl_group_req *req; | 233 | struct dgl_group_req *req; |
233 | #endif | 234 | #endif |
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index 84b4fab5c2ca..d14eeaf0099f 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
@@ -82,7 +82,7 @@ struct st_sys_release_data { | |||
82 | }; | 82 | }; |
83 | 83 | ||
84 | struct st_task_exit_data { | 84 | struct st_task_exit_data { |
85 | u64 when; | 85 | u64 avg_exec_time; |
86 | u64 max_exec_time; | 86 | u64 max_exec_time; |
87 | }; | 87 | }; |
88 | 88 | ||
diff --git a/litmus/jobs.c b/litmus/jobs.c index 36e314625d86..4da53a8c4c43 100644 --- a/litmus/jobs.c +++ b/litmus/jobs.c | |||
@@ -9,12 +9,15 @@ | |||
9 | void prepare_for_next_period(struct task_struct *t) | 9 | void prepare_for_next_period(struct task_struct *t) |
10 | { | 10 | { |
11 | BUG_ON(!t); | 11 | BUG_ON(!t); |
12 | #ifdef CONFIG_PLUGIN_COLOR | ||
13 | tsk_rt(t)->tot_exec_time += tsk_rt(t)->job_params.exec_time; | ||
14 | #endif | ||
12 | /* prepare next release */ | 15 | /* prepare next release */ |
13 | t->rt_param.job_params.release = t->rt_param.job_params.deadline; | 16 | tsk_rt(t)->job_params.release = tsk_rt(t)->job_params.deadline; |
14 | t->rt_param.job_params.deadline += get_rt_period(t); | 17 | tsk_rt(t)->job_params.deadline += get_rt_period(t); |
15 | t->rt_param.job_params.exec_time = 0; | 18 | tsk_rt(t)->job_params.exec_time = 0; |
16 | /* update job sequence number */ | 19 | /* update job sequence number */ |
17 | t->rt_param.job_params.job_no++; | 20 | tsk_rt(t)->job_params.job_no++; |
18 | 21 | ||
19 | /* don't confuse Linux */ | 22 | /* don't confuse Linux */ |
20 | t->rt.time_slice = 1; | 23 | t->rt.time_slice = 1; |
@@ -22,7 +25,7 @@ void prepare_for_next_period(struct task_struct *t) | |||
22 | 25 | ||
23 | void release_at(struct task_struct *t, lt_t start) | 26 | void release_at(struct task_struct *t, lt_t start) |
24 | { | 27 | { |
25 | t->rt_param.job_params.deadline = start; | 28 | tsk_rt(t)->job_params.deadline = start; |
26 | prepare_for_next_period(t); | 29 | prepare_for_next_period(t); |
27 | set_rt_flags(t, RT_F_RUNNING); | 30 | set_rt_flags(t, RT_F_RUNNING); |
28 | } | 31 | } |
diff --git a/litmus/sched_color.c b/litmus/sched_color.c index 6c278f5d26cf..29b2be97da52 100644 --- a/litmus/sched_color.c +++ b/litmus/sched_color.c | |||
@@ -534,6 +534,7 @@ static void color_task_new(struct task_struct *t, int on_rq, int running) | |||
534 | tsk_rt(t)->req = req; | 534 | tsk_rt(t)->req = req; |
535 | 535 | ||
536 | tsk_rt(t)->max_exec_time = 0; | 536 | tsk_rt(t)->max_exec_time = 0; |
537 | tsk_rt(t)->tot_exec_time = 0; | ||
537 | 538 | ||
538 | /* Fill request */ | 539 | /* Fill request */ |
539 | if (tsk_rt(t)->color_ctrl_page) { | 540 | if (tsk_rt(t)->color_ctrl_page) { |
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c index afe2333eb723..cbfcecbfe93a 100644 --- a/litmus/sched_task_trace.c +++ b/litmus/sched_task_trace.c | |||
@@ -232,12 +232,14 @@ feather_callback void do_sched_trace_task_exit(unsigned long id, | |||
232 | struct task_struct *t = (struct task_struct*) _task; | 232 | struct task_struct *t = (struct task_struct*) _task; |
233 | #ifdef CONFIG_PLUGIN_COLOR | 233 | #ifdef CONFIG_PLUGIN_COLOR |
234 | const lt_t max_exec_time = tsk_rt(t)->max_exec_time; | 234 | const lt_t max_exec_time = tsk_rt(t)->max_exec_time; |
235 | const lt_t avg_exec_time = tsk_rt(t)->tot_exec_time / (get_rt_job(t) - 1); | ||
235 | #else | 236 | #else |
236 | const lt_t max_exec_time = 0; | 237 | const lt_t max_exec_time = 0; |
238 | const lt_t avg_exec_time = 0; | ||
237 | #endif | 239 | #endif |
238 | struct st_event_record *rec = get_record(ST_TASK_EXIT, t); | 240 | struct st_event_record *rec = get_record(ST_TASK_EXIT, t); |
239 | if (rec) { | 241 | if (rec) { |
240 | rec->data.task_exit.when = now(); | 242 | rec->data.task_exit.avg_exec_time = avg_exec_time; |
241 | rec->data.task_exit.max_exec_time = max_exec_time; | 243 | rec->data.task_exit.max_exec_time = max_exec_time; |
242 | put_record(rec); | 244 | put_record(rec); |
243 | } | 245 | } |