diff options
author | Juri Lelli <juri.lelli@gmail.com> | 2014-03-05 12:26:39 +0100 |
---|---|---|
committer | Juri Lelli <juri.lelli@gmail.com> | 2014-03-05 11:28:05 +0100 |
commit | 071996b2529d5917935b3686a5c35e822fcf2559 (patch) | |
tree | b7742bd6e6e83bf093dfbf932eaa9a2e163456e5 | |
parent | d3c7e6e80d6becc1ef1029a40b6583b5d1c5a596 (diff) |
add a command line option to die on deadline miss
-rw-r--r-- | src/rt-app.c | 4 | ||||
-rw-r--r-- | src/rt-app_args.c | 30 | ||||
-rw-r--r-- | src/rt-app_types.h | 1 |
3 files changed, 23 insertions, 12 deletions
diff --git a/src/rt-app.c b/src/rt-app.c index bf48f93..75f51b3 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -338,6 +338,10 @@ void *thread_body(void *arg) curr_timing->deadline = timespec_to_usec(&data->deadline); curr_timing->duration = timespec_to_usec(&t_diff); curr_timing->slack = timespec_to_lusec(&t_slack); + if (curr_timing->slack < 0 && opts.die_on_dmiss) { + log_critical("[%d] DEADLINE MISS !!!", data->ind); + exit(EXIT_FAILURE); + } #ifdef AQUOSA if (data->sched_policy == aquosa) { curr_timing->budget = data->params.Q; diff --git a/src/rt-app_args.c b/src/rt-app_args.c index 78f5173..f24e4c9 100644 --- a/src/rt-app_args.c +++ b/src/rt-app_args.c @@ -28,17 +28,18 @@ usage (const char* msg, int ex_code) #endif printf("rt-app [options] -t <period>:<exec>[:policy" "[:CPU affinity[:prio[:deadline]]]] -t ...\n\n"); - printf("-h, --help\t:\tshow this help\n"); - printf("-f, --fifo\t:\tset default policy for threads to SCHED_FIFO\n"); - printf("-r, --rr\t:\tset default policy fior threads to SCHED_RR\n"); - printf("-s, --spacing\t:\tmsec to wait beetween thread starts\n"); - printf("-l, --logdir\t:\tsave logs to different directory\n"); - printf("-b, --baselog\t:\tbasename for logs (implies -l . if not set)\n"); - printf("-G, --gnuplot\t:\tgenerate gnuplot script (needs -l)\n"); - printf("-D, --duration\t:\ttime (in seconds) before stopping threads\n"); - printf("-K, --no-mlock\t:\tDo not lock pages in memory\n"); - printf("-T, --ftrace\t:\tenable ftrace prints\n"); + printf("-h, --help\t\t:\tshow this help\n"); + printf("-f, --fifo\t\t:\tset default policy for threads to SCHED_FIFO\n"); + printf("-r, --rr\t\t:\tset default policy fior threads to SCHED_RR\n"); + printf("-s, --spacing\t\t:\tmsec to wait beetween thread starts\n"); + printf("-l, --logdir\t\t:\tsave logs to different directory\n"); + printf("-b, --baselog\t\t:\tbasename for logs (implies -l . if not set)\n"); + printf("-G, --gnuplot\t\t:\tgenerate gnuplot script (needs -l)\n"); + printf("-D, --duration\t\t:\ttime (in seconds) before stopping threads\n"); + printf("-K, --no-mlock\t\t:\tDo not lock pages in memory\n"); + printf("-T, --ftrace\t\t:\tenable ftrace prints\n"); printf("-P, --pi_enabled\t:\tenable priority inheritance on resources\n"); + printf("-M, --die_on_dmiss\t:\texit with an error if a task misses a deadline\n"); #ifdef AQUOSA printf("-q, --qos\t:\tcreate AQuoSA reservation\n"); @@ -215,6 +216,7 @@ parse_command_line_options(int argc, char **argv, rtapp_options_t *opts) opts->logdir = NULL; opts->nthreads = 0; opts->ftrace = 0; + opts->die_on_dmiss = 0; opts->pi_enabled = 0; opts->policy = other; opts->threads_data = malloc(sizeof(thread_data_t)); @@ -233,6 +235,7 @@ parse_command_line_options(int argc, char **argv, rtapp_options_t *opts) {"duration", 1, 0, 'D'}, {"ftrace", 0, 0, 'T'}, {"pi_enabled", 0, 0, 'T'}, + {"die_on_dmiss", 0, 0, 'M'}, #ifdef AQUOSA {"qos", 0, 0, 'q'}, {"frag",1, 0, 'g'}, @@ -240,10 +243,10 @@ parse_command_line_options(int argc, char **argv, rtapp_options_t *opts) {0, 0, 0, 0} }; #ifdef AQUOSA - while (( ch = getopt_long(argc,argv,"D:GKhfrb:s:l:qg:t:T", + while (( ch = getopt_long(argc,argv,"D:GKhfrb:s:l:qg:t:TM", long_options, &longopt_idx)) != -1) #else - while (( ch = getopt_long(argc,argv,"D:GKhfrb:s:l:t:T", + while (( ch = getopt_long(argc,argv,"D:GKhfrb:s:l:t:TM", long_options, &longopt_idx)) != -1) #endif { @@ -313,6 +316,9 @@ parse_command_line_options(int argc, char **argv, rtapp_options_t *opts) case 'P': opts->pi_enabled = 1; break; + case 'M': + opts->die_on_dmiss = 1; + break; #ifdef AQUOSA case 'q': if (opts->policy != other) diff --git a/src/rt-app_types.h b/src/rt-app_types.h index f84611c..32700ef 100644 --- a/src/rt-app_types.h +++ b/src/rt-app_types.h @@ -129,6 +129,7 @@ typedef struct _rtapp_options_t { int pi_enabled; int ftrace; + int die_on_dmiss; #ifdef AQUOSA int fragment; |