From 1cb90226816c7af7808be4c0de866c54da17ecc9 Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Tue, 15 May 2012 13:39:52 -0400 Subject: Summarize schedulability with final record --- include/litmus/rt_param.h | 5 +++++ include/litmus/sched_trace.h | 19 +++++++++++++++++++ litmus/sched_color.c | 15 ++++++++++++++- 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 { /* Pointer to the page shared between userspace and kernel. */ struct control_page * ctrl_page; + + lt_t total_tardy; + lt_t max_tardy; + unsigned int missed; + #ifdef CONFIG_PLUGIN_COLOR lt_t max_exec_time; 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 { u64 max_exec_time; }; +struct st_task_tardy_data { + u64 total_tardy; + u32 max_tardy; + u32 missed; +}; + #define DATA(x) struct st_ ## x ## _data x; typedef enum { @@ -102,6 +108,7 @@ typedef enum { ST_ACTION, ST_SYS_RELEASE, ST_TASK_EXIT, + ST_TASK_TARDY, } st_event_record_type_t; struct st_event_record { @@ -121,6 +128,7 @@ struct st_event_record { DATA(action); DATA(sys_release); DATA(task_exit); + DATA(task_tardy); } data; }; @@ -164,6 +172,8 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, lt_t* start); feather_callback void do_sched_trace_task_exit(unsigned long id, struct task_struct* task); +feather_callback void do_sched_trace_task_tardy(unsigned long id, + struct task_struct* task); #endif @@ -190,6 +200,7 @@ feather_callback void do_sched_trace_task_exit(unsigned long id, #define trace_litmus_task_resume(t, i) #define trace_litmus_sys_release(start) #define trace_litmus_task_exit(t) +#define trace_litmus_task_tardy(t) #define trace_litmus_resource_acquire(t, i); #define trace_litmus_resource_release(t, i); @@ -281,6 +292,14 @@ feather_callback void do_sched_trace_task_exit(unsigned long id, trace_litmus_task_exit(t); \ } while (0) + +#define sched_trace_task_tardy(t) \ + do { \ + SCHED_TRACE(SCHED_TRACE_BASE_ID + 12, \ + do_sched_trace_task_tardy, t); \ + trace_litmus_task_tardy(t); \ + } while (0) + #define QT_START lt_t _qt_start = litmus_clock() #define QT_END \ 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) static void job_completion(struct rt_server *server) { struct task_struct *t = server->linked; - lt_t et; + lt_t et, now = litmus_clock(); TRACE_TASK(t, "Job completed\n"); if (is_server(t)) @@ -320,6 +320,15 @@ static void job_completion(struct rt_server *server) tsk_rt(t)->max_exec_time = et; } + if (is_tardy(t, now)) { + lt_t miss = now - get_deadline(t); + ++tsk_rt(t)->missed; + tsk_rt(t)->total_tardy += miss; + if (lt_before(tsk_rt(t)->max_tardy, miss)) { + tsk_rt(t)->max_tardy = miss; + } + } + unlink(server); set_rt_flags(t, RT_F_SLEEP); prepare_for_next_period(t); @@ -566,6 +575,9 @@ static void color_task_new(struct task_struct *t, int on_rq, int running) tsk_rt(t)->req = req; tsk_rt(t)->tot_exec_time = 0; tsk_rt(t)->max_exec_time = 0; + tsk_rt(t)->max_tardy = 0; + tsk_rt(t)->missed = 0; + tsk_rt(t)->total_tardy = 0; tsk_rt(t)->ctrl_page->colors_updated = 1; tsk_rt(t)->last_exec_time = 0; @@ -644,6 +656,7 @@ static void color_task_exit(struct task_struct *t) local_irq_save(flags); sched_trace_task_exit(t); + sched_trace_task_tardy(t); /* Remove from scheduler consideration */ 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, } feather_callback void do_sched_trace_task_exit(unsigned long id, - unsigned long _task) + unsigned long _task) { struct task_struct *t = (struct task_struct*) _task; #ifdef CONFIG_PLUGIN_COLOR @@ -245,6 +245,19 @@ feather_callback void do_sched_trace_task_exit(unsigned long id, } } +feather_callback void do_sched_trace_task_tardy(unsigned long id, + unsigned long _task) +{ + struct task_struct *t = (struct task_struct*) _task; + struct st_event_record *rec = get_record(ST_TASK_TARDY, t); + if (rec) { + rec->data.task_tardy.max_tardy = tsk_rt(t)->max_tardy; + rec->data.task_tardy.total_tardy = tsk_rt(t)->total_tardy; + rec->data.task_tardy.missed = tsk_rt(t)->missed; + put_record(rec); + } +} + feather_callback void do_sched_trace_action(unsigned long id, unsigned long _task, unsigned long action) -- cgit v1.2.2