From 9bbedd1b59b55650767395eabf093e0400d4bd97 Mon Sep 17 00:00:00 2001 From: Christopher Kenna Date: Tue, 11 Oct 2011 23:34:45 -0400 Subject: add level-A scheduling event --- include/litmus/trace.h | 6 +++++- kernel/sched.c | 2 ++ litmus/trace.c | 12 ++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/litmus/trace.h b/include/litmus/trace.h index 4fe4aadea8eb..db91ff69b51e 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h @@ -12,7 +12,8 @@ enum task_type_marker { TSK_BE, TSK_RT, - TSK_UNKNOWN + TSK_UNKNOWN, + TSK_LVLA }; struct timestamp { @@ -111,6 +112,9 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim #define TS_LVLA_RELEASE_START DTIMESTAMP(112, TSK_RT) #define TS_LVLA_RELEASE_END DTIMESTAMP(113, TSK_RT) +#define TS_LVLA_SCHED_START DTIMESTAMP(114, TSK_UNKNOWN) +#define TS_LVLA_SCHED_END(t) TTIMESTAMP(115, t) + #define TS_PLUGIN_SCHED_START /* TIMESTAMP(120) */ /* currently unused */ #define TS_PLUGIN_SCHED_END /* TIMESTAMP(121) */ diff --git a/kernel/sched.c b/kernel/sched.c index c5d775079027..71907dcd8112 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3810,6 +3810,7 @@ need_resched: release_kernel_lock(prev); need_resched_nonpreemptible: TS_SCHED_START; + TS_LVLA_SCHED_START; sched_trace_task_switch_away(prev); schedule_debug(prev); @@ -3859,6 +3860,7 @@ need_resched_nonpreemptible: rq->curr = next; ++*switch_count; + TS_LVLA_SCHED_END(next); TS_SCHED_END(next); TS_CXS_START(next); context_switch(rq, prev, next); /* unlocks the rq */ diff --git a/litmus/trace.c b/litmus/trace.c index 49f8246cda50..417422d2f16d 100644 --- a/litmus/trace.c +++ b/litmus/trace.c @@ -4,6 +4,7 @@ #include #include #include +#include /******************************************************************************/ /* Allocation */ @@ -81,8 +82,15 @@ feather_callback void save_timestamp_def(unsigned long event, feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr) { - int rt = is_realtime((struct task_struct *) t_ptr); - __save_timestamp(event, rt ? TSK_RT : TSK_BE); + struct task_struct *ts = t_ptr; + int rt = is_realtime(ts); + uint8_t type = rt ? TSK_RT : TSK_BE; + + if (TS_LVLA_SCHED_END == event) { + if (rt && CRIT_LEVEL_A == tsk_mc_crit(ts)) + type = TSK_LVLA; + } + __save_timestamp(event, type); } feather_callback void save_timestamp_cpu(unsigned long event, -- cgit v1.2.2