From e7869361400ef89ae169c1acf17296b7ada47cc8 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Mon, 8 Oct 2007 20:44:26 -0400 Subject: adaptive: kick out weight-transfer function weight-transfer function is redundant with per service level weights --- src/adaptive.c | 16 ++++------------ src/rt_launch.c | 57 ++++++++++----------------------------------------------- 2 files changed, 14 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/adaptive.c b/src/adaptive.c index 8dfb27b..ebf662d 100644 --- a/src/adaptive.c +++ b/src/adaptive.c @@ -11,11 +11,9 @@ int set_service_levels(pid_t pid, unsigned int nr_levels, - service_level_t* levels, - fp_t *wt_y, - fp_t *wt_slope) + service_level_t* levels) { - return syscall(__NR_set_service_levels, pid, nr_levels, levels, wt_y, wt_slope); + return syscall(__NR_set_service_levels, pid, nr_levels, levels); } @@ -28,25 +26,19 @@ int get_cur_service_level(void) struct adaptive_param { unsigned int no_levels; service_level_t* levels; - fp_t wt_y; - fp_t wt_slope; }; int setup_adaptive(int pid, struct adaptive_param* arg) { - return set_service_levels(pid, arg->no_levels, arg->levels, - &arg->wt_y, &arg->wt_slope); + return set_service_levels(pid, arg->no_levels, arg->levels); } int create_adaptive_rt_task(rt_fn_t rt_prog, void *arg, - unsigned int no_levels, service_level_t* levels, - fp_t wt_y, fp_t wt_slope) + unsigned int no_levels, service_level_t* levels) { struct adaptive_param p; p.no_levels = no_levels; p.levels = levels; - p.wt_y = wt_y; - p.wt_slope = wt_slope; return __launch_rt_task(rt_prog, arg, (rt_setup_fn_t) setup_adaptive, &p); } diff --git a/src/rt_launch.c b/src/rt_launch.c index b76cb8c..7098e73 100644 --- a/src/rt_launch.c +++ b/src/rt_launch.c @@ -23,20 +23,19 @@ int launch(void *task_info_p) { void usage(char *error) { fprintf(stderr, "%s\nUsage: \nlaunch_rt supports one of two modes:\n" - "\n\tlaunch_rt program arg1 arg2 ...\n" + "\n\tlaunch_rt program arg1 arg2 ...\n" "\n\tlaunch_rt program arg1 arg2 ...\n" "\nwhere:" "\n\t = " - "[-c {hrt|srt|be}] [-p ] \n" + "[-c {hrt|srt|be}] [-p ]\n" "\n\t = " - "(-a weight/period/utility)+ [-w +v]\n" + "(-a weight/period/utility)+\n" "\nExamples:" "\n\trt_launch -p 2 10 100 cpu_job" - "\n\t => Launch cpu_job a hard real-time task with period 100 and weight 0.1" - "\n\t on CPU 2.\n" - "\n\trt_launch -a 0.1/100/0.4 -a 0.2/75/0.5 -w 0.2+0.3v adaptive_job" - "\n\t => Launch adaptive_job with two service levels and a custom " - "\n\t weight-transfer function." + "\n\t => Launch cpu_job a hard real-time task with " + "\n\t period 100 and weight 0.1 on CPU 2.\n" + "\n\trt_launch -a 0.1/100/0.4 -a 0.2/75/0.5 adaptive_job" + "\n\t => Launch adaptive_job with two service levels" "\n\n", error); exit(1); @@ -67,33 +66,8 @@ static int parse_service_level(service_level_t* level, char* str) return 1; } -/* argument format should be +v */ -static int parse_wt(fp_t *_y, fp_t *_slope, char* str) -{ - char *y, *slope; - double yf, sf; - y = strtok(str, "+"); - slope = strtok(NULL, "v"); - str = strtok(NULL, "/"); /* If we find anyting at all then the - * string is malformed. - */ - if (str || !y || !slope) - return 0; - - yf = strtof(y, &y); - sf = strtof(slope, &slope); - - if (*y || *slope || - yf < 0.0 || sf <= 0.0) - return 0; - - *_y = f2fp(yf); - *_slope = f2fp(sf); - return 1; -} - -#define OPTSTR "p:c:a:w:" +#define OPTSTR "p:c:a:" int main(int argc, char** argv) { @@ -107,13 +81,7 @@ int main(int argc, char** argv) int adaptive = 0; unsigned int level = 0; - service_level_t slevel[MAX_SERVICE_LEVELS]; - fp_t wt_y; /* weight-transfer y intercept */ - fp_t wt_slope; /* weight-transfer slope */ - - - wt_y = f2fp(0.0); - wt_slope = f2fp(1.0); + service_level_t slevel[MAX_SERVICE_LEVELS]; while ((opt = getopt(argc, argv, OPTSTR)) != -1) { switch (opt) { @@ -124,10 +92,6 @@ int main(int argc, char** argv) if (!parse_service_level(slevel + level++, optarg)) usage("Bad service level."); break; - case 'w': - if (!parse_wt(&wt_y, &wt_slope, optarg)) - usage("Bad weight transfer function."); - break; case 'p': cpu = atoi(optarg); break; @@ -169,8 +133,7 @@ int main(int argc, char** argv) usage("Arguments missing."); info.exec_path = argv[optind]; info.argv = argv + optind; - ret = create_adaptive_rt_task(launch, &info, level, slevel, - wt_y, wt_slope); + ret = create_adaptive_rt_task(launch, &info, level, slevel); } -- cgit v1.2.2