diff options
-rw-r--r-- | include/litmus/rt_param.h | 5 | ||||
-rw-r--r-- | include/litmus/sched_trace.h | 19 | ||||
-rw-r--r-- | litmus/sched_color.c | 15 | ||||
-rw-r--r-- | litmus/sched_task_trace.c | 15 |
4 files changed, 52 insertions, 2 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 003eaf32aa7f..ef9f1fb77c5b 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -228,6 +228,11 @@ struct rt_param { | |||
228 | /* Pointer to the page shared between userspace and kernel. */ | 228 | /* Pointer to the page shared between userspace and kernel. */ |
229 | struct control_page * ctrl_page; | 229 | struct control_page * ctrl_page; |
230 | 230 | ||
231 | |||
232 | lt_t total_tardy; | ||
233 | lt_t max_tardy; | ||
234 | unsigned int missed; | ||
235 | |||
231 | #ifdef CONFIG_PLUGIN_COLOR | 236 | #ifdef CONFIG_PLUGIN_COLOR |
232 | lt_t max_exec_time; | 237 | lt_t max_exec_time; |
233 | lt_t tot_exec_time; | 238 | lt_t tot_exec_time; |
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index d14eeaf0099f..c94b096cf855 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
@@ -86,6 +86,12 @@ struct st_task_exit_data { | |||
86 | u64 max_exec_time; | 86 | u64 max_exec_time; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | struct st_task_tardy_data { | ||
90 | u64 total_tardy; | ||
91 | u32 max_tardy; | ||
92 | u32 missed; | ||
93 | }; | ||
94 | |||
89 | #define DATA(x) struct st_ ## x ## _data x; | 95 | #define DATA(x) struct st_ ## x ## _data x; |
90 | 96 | ||
91 | typedef enum { | 97 | typedef enum { |
@@ -102,6 +108,7 @@ typedef enum { | |||
102 | ST_ACTION, | 108 | ST_ACTION, |
103 | ST_SYS_RELEASE, | 109 | ST_SYS_RELEASE, |
104 | ST_TASK_EXIT, | 110 | ST_TASK_EXIT, |
111 | ST_TASK_TARDY, | ||
105 | } st_event_record_type_t; | 112 | } st_event_record_type_t; |
106 | 113 | ||
107 | struct st_event_record { | 114 | struct st_event_record { |
@@ -121,6 +128,7 @@ struct st_event_record { | |||
121 | DATA(action); | 128 | DATA(action); |
122 | DATA(sys_release); | 129 | DATA(sys_release); |
123 | DATA(task_exit); | 130 | DATA(task_exit); |
131 | DATA(task_tardy); | ||
124 | } data; | 132 | } data; |
125 | }; | 133 | }; |
126 | 134 | ||
@@ -164,6 +172,8 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
164 | lt_t* start); | 172 | lt_t* start); |
165 | feather_callback void do_sched_trace_task_exit(unsigned long id, | 173 | feather_callback void do_sched_trace_task_exit(unsigned long id, |
166 | struct task_struct* task); | 174 | struct task_struct* task); |
175 | feather_callback void do_sched_trace_task_tardy(unsigned long id, | ||
176 | struct task_struct* task); | ||
167 | 177 | ||
168 | #endif | 178 | #endif |
169 | 179 | ||
@@ -190,6 +200,7 @@ feather_callback void do_sched_trace_task_exit(unsigned long id, | |||
190 | #define trace_litmus_task_resume(t, i) | 200 | #define trace_litmus_task_resume(t, i) |
191 | #define trace_litmus_sys_release(start) | 201 | #define trace_litmus_sys_release(start) |
192 | #define trace_litmus_task_exit(t) | 202 | #define trace_litmus_task_exit(t) |
203 | #define trace_litmus_task_tardy(t) | ||
193 | 204 | ||
194 | #define trace_litmus_resource_acquire(t, i); | 205 | #define trace_litmus_resource_acquire(t, i); |
195 | #define trace_litmus_resource_release(t, i); | 206 | #define trace_litmus_resource_release(t, i); |
@@ -281,6 +292,14 @@ feather_callback void do_sched_trace_task_exit(unsigned long id, | |||
281 | trace_litmus_task_exit(t); \ | 292 | trace_litmus_task_exit(t); \ |
282 | } while (0) | 293 | } while (0) |
283 | 294 | ||
295 | |||
296 | #define sched_trace_task_tardy(t) \ | ||
297 | do { \ | ||
298 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 12, \ | ||
299 | do_sched_trace_task_tardy, t); \ | ||
300 | trace_litmus_task_tardy(t); \ | ||
301 | } while (0) | ||
302 | |||
284 | #define QT_START lt_t _qt_start = litmus_clock() | 303 | #define QT_START lt_t _qt_start = litmus_clock() |
285 | #define QT_END \ | 304 | #define QT_END \ |
286 | sched_trace_log_message("%d P%d [%s@%s:%d]: Took %llu\n\n", \ | 305 | sched_trace_log_message("%d P%d [%s@%s:%d]: Took %llu\n\n", \ |
diff --git a/litmus/sched_color.c b/litmus/sched_color.c index e72fdc3bb7d1..44327d60aaa5 100644 --- a/litmus/sched_color.c +++ b/litmus/sched_color.c | |||
@@ -305,7 +305,7 @@ static void job_arrival(struct task_struct *t) | |||
305 | static void job_completion(struct rt_server *server) | 305 | static void job_completion(struct rt_server *server) |
306 | { | 306 | { |
307 | struct task_struct *t = server->linked; | 307 | struct task_struct *t = server->linked; |
308 | lt_t et; | 308 | lt_t et, now = litmus_clock(); |
309 | 309 | ||
310 | TRACE_TASK(t, "Job completed\n"); | 310 | TRACE_TASK(t, "Job completed\n"); |
311 | if (is_server(t)) | 311 | if (is_server(t)) |
@@ -320,6 +320,15 @@ static void job_completion(struct rt_server *server) | |||
320 | tsk_rt(t)->max_exec_time = et; | 320 | tsk_rt(t)->max_exec_time = et; |
321 | } | 321 | } |
322 | 322 | ||
323 | if (is_tardy(t, now)) { | ||
324 | lt_t miss = now - get_deadline(t); | ||
325 | ++tsk_rt(t)->missed; | ||
326 | tsk_rt(t)->total_tardy += miss; | ||
327 | if (lt_before(tsk_rt(t)->max_tardy, miss)) { | ||
328 | tsk_rt(t)->max_tardy = miss; | ||
329 | } | ||
330 | } | ||
331 | |||
323 | unlink(server); | 332 | unlink(server); |
324 | set_rt_flags(t, RT_F_SLEEP); | 333 | set_rt_flags(t, RT_F_SLEEP); |
325 | prepare_for_next_period(t); | 334 | prepare_for_next_period(t); |
@@ -566,6 +575,9 @@ static void color_task_new(struct task_struct *t, int on_rq, int running) | |||
566 | tsk_rt(t)->req = req; | 575 | tsk_rt(t)->req = req; |
567 | tsk_rt(t)->tot_exec_time = 0; | 576 | tsk_rt(t)->tot_exec_time = 0; |
568 | tsk_rt(t)->max_exec_time = 0; | 577 | tsk_rt(t)->max_exec_time = 0; |
578 | tsk_rt(t)->max_tardy = 0; | ||
579 | tsk_rt(t)->missed = 0; | ||
580 | tsk_rt(t)->total_tardy = 0; | ||
569 | tsk_rt(t)->ctrl_page->colors_updated = 1; | 581 | tsk_rt(t)->ctrl_page->colors_updated = 1; |
570 | tsk_rt(t)->last_exec_time = 0; | 582 | tsk_rt(t)->last_exec_time = 0; |
571 | 583 | ||
@@ -644,6 +656,7 @@ static void color_task_exit(struct task_struct *t) | |||
644 | local_irq_save(flags); | 656 | local_irq_save(flags); |
645 | 657 | ||
646 | sched_trace_task_exit(t); | 658 | sched_trace_task_exit(t); |
659 | sched_trace_task_tardy(t); | ||
647 | 660 | ||
648 | /* Remove from scheduler consideration */ | 661 | /* Remove from scheduler consideration */ |
649 | if (is_queued(t)) { | 662 | if (is_queued(t)) { |
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c index 48124b756be7..d4fedaa15744 100644 --- a/litmus/sched_task_trace.c +++ b/litmus/sched_task_trace.c | |||
@@ -227,7 +227,7 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
227 | } | 227 | } |
228 | 228 | ||
229 | feather_callback void do_sched_trace_task_exit(unsigned long id, | 229 | feather_callback void do_sched_trace_task_exit(unsigned long id, |
230 | unsigned long _task) | 230 | unsigned long _task) |
231 | { | 231 | { |
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 |
@@ -245,6 +245,19 @@ feather_callback void do_sched_trace_task_exit(unsigned long id, | |||
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | feather_callback void do_sched_trace_task_tardy(unsigned long id, | ||
249 | unsigned long _task) | ||
250 | { | ||
251 | struct task_struct *t = (struct task_struct*) _task; | ||
252 | struct st_event_record *rec = get_record(ST_TASK_TARDY, t); | ||
253 | if (rec) { | ||
254 | rec->data.task_tardy.max_tardy = tsk_rt(t)->max_tardy; | ||
255 | rec->data.task_tardy.total_tardy = tsk_rt(t)->total_tardy; | ||
256 | rec->data.task_tardy.missed = tsk_rt(t)->missed; | ||
257 | put_record(rec); | ||
258 | } | ||
259 | } | ||
260 | |||
248 | feather_callback void do_sched_trace_action(unsigned long id, | 261 | feather_callback void do_sched_trace_action(unsigned long id, |
249 | unsigned long _task, | 262 | unsigned long _task, |
250 | unsigned long action) | 263 | unsigned long action) |