From 52006dedc0a2ba4d8a1901e8940eb80f8c02033e Mon Sep 17 00:00:00 2001 From: Namhoon Kim Date: Mon, 25 Nov 2013 17:23:23 -0500 Subject: First draft of C-FL-split factor support 1) added -n option in rtspin to specify split factor --- README | 2 +- bin/rt_launch.c | 9 +++++++-- bin/rtspin.c | 11 +++++++++-- include/litmus.h | 4 ++-- src/task.c | 7 ++++--- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README b/README index accdf72..c5eaca2 100644 --- a/README +++ b/README @@ -33,7 +33,7 @@ Tools and Programs worst-case execution time and priod. Any additional parameters are passed on to the real-time task. -* rtspin [-w] [-p ] [-c CLASS] WCET PERIOD DURATION +* rtspin [-w] [-n SPLIT] [-p ] [-c CLASS] WCET PERIOD DURATION rtspin -l A simple spin loop for emulating purely CPU-bound workloads. Not very realistic, but a good tool for debugging. diff --git a/bin/rt_launch.c b/bin/rt_launch.c index 93f10d5..209ff15 100644 --- a/bin/rt_launch.c +++ b/bin/rt_launch.c @@ -32,6 +32,7 @@ void usage(char *error) { fprintf(stderr, "%s\nUsage: rt_launch [-w][-v][-p partition/cluster [-z cluster size]][-q prio][-c hrt | srt | be] wcet period program [arg1 arg2 ...]\n" "\t-w\tSynchronous release\n" "\t-v\tVerbose\n" + "\t-n\tSplit factor\n" "\t-p\tpartition or cluster\n" "\t-z\tsize of cluster (default = 1 for partitioned)\n" "\t-c\tClass\n" @@ -42,7 +43,7 @@ void usage(char *error) { } -#define OPTSTR "p:z:c:vwq:" +#define OPTSTR "p:z:c:vwq:n:" int main(int argc, char** argv) { @@ -50,6 +51,7 @@ int main(int argc, char** argv) lt_t wcet; lt_t period; int migrate = 0; + int split = 1; int cluster = 0; int cluster_size = 1; int opt; @@ -67,6 +69,9 @@ int main(int argc, char** argv) case 'v': verbose = 1; break; + case 'n': + split = atoi(optarg); + break; case 'p': cluster = atoi(optarg); migrate = 1; @@ -118,7 +123,7 @@ int main(int argc, char** argv) if (ret < 0) bail_out("could not migrate to target partition or cluster"); } - ret = __create_rt_task(launch, &info, cluster, cluster_size, wcet, period, + ret = __create_rt_task(launch, &info, split, cluster, cluster_size, wcet, period, priority, class); diff --git a/bin/rtspin.c b/bin/rtspin.c index 167741d..5de9035 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c @@ -21,7 +21,7 @@ static void usage(char *error) { " rt_spin [COMMON-OPTS] -f FILE [-o COLUMN] WCET PERIOD\n" " rt_spin -l\n" "\n" - "COMMON-OPTS = [-w] [-s SCALE]\n" + "COMMON-OPTS = [-w] [-s SCALE] [-n SPLIT]\n" " [-p PARTITION/CLUSTER [-z CLUSTER SIZE]] [-c CLASS]\n" " [-X LOCKING-PROTOCOL] [-L CRITICAL SECTION LENGTH] [-Q RESOURCE-ID]" "\n" @@ -184,7 +184,7 @@ static int job(double exec_time, double program_end, int lock_od, double cs_leng } } -#define OPTSTR "p:z:c:wlveo:f:s:q:X:L:Q:" +#define OPTSTR "p:z:c:wlveo:f:s:q:X:L:Q:n:" int main(int argc, char** argv) { int ret; @@ -199,6 +199,7 @@ int main(int argc, char** argv) int wait = 0; int test_loop = 0; int column = 1; + int split = 1; const char *file = NULL; int want_enforcement = 0; double duration = 0, start = 0; @@ -222,6 +223,9 @@ int main(int argc, char** argv) case 'w': wait = 1; break; + case 'n': + split = atoi(optarg); + break; case 'p': cluster = atoi(optarg); migrate = 1; @@ -315,6 +319,8 @@ int main(int argc, char** argv) "positive number."); if (period <= 0) usage("The period must be a positive number."); + if (split <= 0) + usage("The split factor must be a positive number, if specified."); if (!file && wcet > period) { usage("The worst-case execution time must not " "exceed the period."); @@ -334,6 +340,7 @@ int main(int argc, char** argv) init_rt_task_param(¶m); param.exec_cost = wcet; param.period = period; + param.split = split; param.priority = priority; param.cls = class; param.budget_policy = (want_enforcement) ? diff --git a/include/litmus.h b/include/litmus.h index dde5469..ad72eb7 100644 --- a/include/litmus.h +++ b/include/litmus.h @@ -96,9 +96,9 @@ typedef int (*rt_fn_t)(void*); * Partitioned scheduling: cluster = desired partition, cluster_size = 1 * Global scheduling: cluster = 0, cluster_size = 0 */ -int create_rt_task(rt_fn_t rt_prog, void *arg, int cluster, int cluster_size, +int create_rt_task(rt_fn_t rt_prog, void *arg, int split, int cluster, int cluster_size, lt_t wcet, lt_t period, unsigned int prio); -int __create_rt_task(rt_fn_t rt_prog, void *arg, int cluster, int cluster_size, +int __create_rt_task(rt_fn_t rt_prog, void *arg, int split, int cluster, int cluster_size, lt_t wcet, lt_t period, unsigned int prio, task_class_t cls); /* per-task modes */ diff --git a/src/task.c b/src/task.c index 5f2fa26..f3866f9 100644 --- a/src/task.c +++ b/src/task.c @@ -40,10 +40,11 @@ int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, rt_setup_fn_t setup, return rt_task; } -int __create_rt_task(rt_fn_t rt_prog, void *arg, int cluster, int cluster_size, +int __create_rt_task(rt_fn_t rt_prog, void *arg, int split, int cluster, int cluster_size, lt_t wcet, lt_t period, unsigned int priority, task_class_t class) { struct rt_task params; + params.split = split; params.cpu = cluster_to_first_cpu(cluster, cluster_size); params.period = period; params.exec_cost = wcet; @@ -57,10 +58,10 @@ int __create_rt_task(rt_fn_t rt_prog, void *arg, int cluster, int cluster_size, (rt_setup_fn_t) set_rt_task_param, ¶ms); } -int create_rt_task(rt_fn_t rt_prog, void *arg, int cluster, int cluster_size, +int create_rt_task(rt_fn_t rt_prog, void *arg, int split, int cluster, int cluster_size, lt_t wcet, lt_t period, unsigned int prio) { - return __create_rt_task(rt_prog, arg, cluster, cluster_size, wcet, period, + return __create_rt_task(rt_prog, arg, split, cluster, cluster_size, wcet, period, prio, RT_CLASS_HARD); } -- cgit v1.2.2