diff options
author | Juri Lelli <juri.lelli@gmail.com> | 2012-03-06 16:17:50 +0100 |
---|---|---|
committer | Juri Lelli <juri.lelli@gmail.com> | 2012-03-22 17:53:42 +0100 |
commit | adf365853c6c6dc438859fe9aed0379c243db796 (patch) | |
tree | 473cca261cbbe8db361d73ec19573637a902e437 /src | |
parent | 522a3845ceeb5b6a42849a25f896a0feac6c0270 (diff) |
Budget overprovisioning.
Diffstat (limited to 'src')
-rw-r--r-- | src/rt-app.c | 34 | ||||
-rw-r--r-- | src/rt-app.h | 2 | ||||
-rw-r--r-- | src/rt-app_utils.c | 2 |
3 files changed, 23 insertions, 15 deletions
diff --git a/src/rt-app.c b/src/rt-app.c index 2f0502e..974b6fe 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -108,6 +108,7 @@ void *thread_body(void *arg) #endif #ifdef DLSCHED pid_t tid; + struct sched_param2 param2; #endif int ret, i = 0; int j; @@ -172,20 +173,14 @@ void *thread_body(void *arg) #ifdef DLSCHED case deadline: tid = gettid(); - data->dl_params.sched_priority = data->sched_prio; - data->dl_params.sched_runtime = timespec_to_nsec(&data->max_et); - data->dl_params.sched_deadline = timespec_to_nsec(&data->period); - data->dl_params.sched_period = timespec_to_nsec(&data->period); + param2.sched_priority = data->sched_prio; + param2.sched_runtime = timespec_to_nsec(&data->max_et) + + (timespec_to_nsec(&data->max_et) /100) * BUDGET_OVERP; + param2.sched_deadline = timespec_to_nsec(&data->period); + param2.sched_period = timespec_to_nsec(&data->period); /* not implemented inside SCHED_DEADLINE V4 */ /* data->dl_params.sched_flags = SCHED_BWRECL_RT; */ - ret = sched_setscheduler2(tid, SCHED_DEADLINE, - &data->dl_params); - if (ret != 0) { - log_critical("[%d] sched_setscheduler2" - "returned %d", data->ind, ret); - exit(EXIT_FAILURE); - } log_notice("[%d] starting thread with period: %lu, exec: %lu," "deadline: %lu, priority: %d", @@ -252,13 +247,24 @@ void *thread_body(void *arg) timings = malloc ( nperiods * sizeof(timing_point_t)); } + fprintf(data->log_handler, "#idx\tperiod\tmin_et\tmax_et\trel_st\tstart" + "\t\tend\t\tdeadline\tdur.\tslack" + "\tBudget\tUsed Budget\n"); + +#ifdef DLSCHED + ret = sched_setscheduler2(tid, SCHED_DEADLINE, + ¶m2); + if (ret != 0) { + log_critical("[%d] sched_setscheduler2 " + "returned %d", data->ind, ret); + exit(EXIT_FAILURE); + } +#endif + clock_gettime(CLOCK_MONOTONIC, &t); t_next = t; data->deadline = timespec_add(&t, &data->deadline); - fprintf(data->log_handler, "#idx\tperiod\tmin_et\tmax_et\trel_st\tstart" - "\t\tend\t\tdeadline\tdur.\tslack" - "\tBudget\tUsed Budget\n"); while (continue_running) { struct timespec t_start, t_end, t_diff, t_slack; diff --git a/src/rt-app.h b/src/rt-app.h index c04871b..ce392f9 100644 --- a/src/rt-app.h +++ b/src/rt-app.h @@ -36,6 +36,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include <aquosa/qres_lib.h> #endif /* AQUOSA */ +#define BUDGET_OVERP 5 + void *thread_body(void *arg); #endif /* _RT_APP_H_ */ diff --git a/src/rt-app_utils.c b/src/rt-app_utils.c index 46bb062..a1f9b56 100644 --- a/src/rt-app_utils.c +++ b/src/rt-app_utils.c @@ -37,7 +37,7 @@ timespec_to_usec(struct timespec *ts) return round((ts->tv_sec * 1E9 + ts->tv_nsec) / 1000.0); } -unsigned long long +__u64 timespec_to_nsec(struct timespec *ts) { return round(ts->tv_sec * 1E9 + ts->tv_nsec); |