aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2016-04-17 10:51:05 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2016-04-17 10:51:05 -0400
commitbaa768c2119053fe444f5b11eed21598e3f670ca (patch)
tree72db7cb5f38f63358f6aafed1130e36a39f5e336
parente23b5f6834be8f7e07ca5ba58e169845ad982ddb (diff)
Clean up help message of rtspin
-rw-r--r--bin/rtspin.c84
1 files changed, 59 insertions, 25 deletions
diff --git a/bin/rtspin.c b/bin/rtspin.c
index db982ed..6cc64fa 100644
--- a/bin/rtspin.c
+++ b/bin/rtspin.c
@@ -14,31 +14,63 @@
14#include "litmus.h" 14#include "litmus.h"
15#include "common.h" 15#include "common.h"
16 16
17const char *usage_msg =
18 "Usage: (1) rtspin OPTIONS WCET PERIOD DURATION\n"
19 " (2) rtspin OPTIONS -F FILE [-C COLUMN] WCET PERIOD\n"
20 " (3) rtspin -l\n"
21 " (4) rtspin -B\n"
22 "\n"
23 "Modes: (1) run as periodic task with given WCET and PERIOD\n"
24 " (2) as (1), but load per-job execution times from a CSV file\n"
25 " (3) Run calibration loop (how accurately are target runtimes met?)\n"
26 " (4) Run background, non-real-time cache-thrashing loop (w/ -m).\n"
27 "\n"
28 "Required arguments:\n"
29 " WCET, PERIOD reservation parameters (in ms)\n"
30 " DURATION terminate the task after DURATION seconds\n"
31 "\n"
32 "Options:\n"
33 " -B run non-real-time background loop\n"
34 " -c be|srt|hrt task class (best-effort, soft real-time, hard real-time)\n"
35 " -d DEADLINE relative deadline, equal to the period by default (in ms)\n"
36 " -e turn on budget enforcement (off by default)\n"
37 " -h show this help message\n"
38 " -i report interrupts (implies -v)\n"
39 " -l run calibration loop and report error\n"
40 " -m FOOTPRINT specify number of data pages to access\n"
41 " -o OFFSET offset (also known as phase), zero by default (in ms)\n"
42 " -p CPU partition or cluster to assign this task to\n"
43 " -q PRIORITY priority to use (ignored by EDF plugins, highest=1, lowest=511)\n"
44 " -r VCPU virtual CPU or reservation to attach to (irrelevant to most plugins)\n"
45 " -R create sporadic reservation for task (with VCPU=PID)\n"
46 " -s SCALE fraction of WCET to spin for (1.0 means 100%)\n"
47 " -u SLACK randomly under-run WCET by up to SLACK milliseconds\n"
48 " -v verbose (print per-job statistics)\n"
49 " -w wait for synchronous release\n"
50 "\n"
51 " -F FILE load per-job execution times from CSV file\n"
52 " -C COLUMNS specify column to read per-job execution times from (default: 1)\n"
53 "\n"
54 " -X PROTOCOL access a shared resource protected by a locking protocol\n"
55 " -L CS-LENGTH simulate a critical section length of CS-LENGTH milliseconds\n"
56 " -Q RESOURCE-ID access the resource identified by RESOURCE-ID\n"
57 "\n"
58 "Units:\n"
59 " WCET and PERIOD are expected in milliseconds.\n"
60 " SLACK is expected in milliseconds.\n"
61 " DURATION is expected in seconds.\n"
62 " CS-LENGTH is expected in milliseconds.\n"
63 " FOOTPRINT is expected in number of pages\n";
17 64
18 65
19static void usage(char *error) { 66static void usage(char *error) {
20 if (error) 67 if (error)
21 fprintf(stderr, "Error: %s\n", error); 68 fprintf(stderr, "Error: %s\n\n", error);
22 fprintf(stderr, 69 else {
23 "Usage:\n" 70 fprintf(stderr, "rtspin: simulate a periodic CPU-bound "
24 " (1) rtspin [COMMON-OPTS] WCET PERIOD DURATION\n" 71 "real-time task\n\n");
25 " (2) rtspin [COMMON-OPTS] -f FILE [-o COLUMN] WCET PERIOD\n" 72 }
26 " (3) rtspin -l\n" 73 fprintf(stderr, usage_msg);
27 " (4) rtspin -B\n"
28 "\n"
29 "Modes: (1) run as periodic task with given WCET and PERIOD\n"
30 " (2) as (1), but load per-job execution times from CSV file\n"
31 " (3) Run calibration loop (how accurately are target runtimes met?)\n"
32 " (4) Run background, non-real-time cache-thrashing loop (w/ -m).\n"
33 "\n"
34 "COMMON-OPTS = [-w] [-s SCALE]\n"
35 " [-p PARTITION/CLUSTER [-z CLUSTER SIZE]] [-c CLASS]\n"
36 " [-X LOCKING-PROTOCOL] [-L CRITICAL SECTION LENGTH] [-Q RESOURCE-ID]\n"
37 " [-m RESIDENT SET SIZE]\n"
38 "\n"
39 "WCET and PERIOD are milliseconds, DURATION is seconds.\n"
40 "CRITICAL SECTION LENGTH is in milliseconds.\n"
41 "RESIDENT SET SIZE is in number of pages\n");
42 exit(error ? EXIT_FAILURE : EXIT_SUCCESS); 74 exit(error ? EXIT_FAILURE : EXIT_SUCCESS);
43} 75}
44 76
@@ -214,7 +246,7 @@ static int job(double exec_time, double program_end, int lock_od, double cs_leng
214 } 246 }
215} 247}
216 248
217#define OPTSTR "p:c:wlveo:f:s:m:q:r:X:L:Q:viRu:Bhd:C:" 249#define OPTSTR "p:c:wlveo:F:s:m:q:r:X:L:Q:iRu:Bhd:C:"
218int main(int argc, char** argv) 250int main(int argc, char** argv)
219{ 251{
220 int ret; 252 int ret;
@@ -298,7 +330,7 @@ int main(int argc, char** argv)
298 case 'C': 330 case 'C':
299 column = atoi(optarg); 331 column = atoi(optarg);
300 break; 332 break;
301 case 'f': 333 case 'F':
302 file = optarg; 334 file = optarg;
303 break; 335 break;
304 case 'm': 336 case 'm':
@@ -344,6 +376,7 @@ int main(int argc, char** argv)
344 usage(NULL); 376 usage(NULL);
345 break; 377 break;
346 case 'i': 378 case 'i':
379 verbose = 1;
347 report_interrupts = 1; 380 report_interrupts = 1;
348 break; 381 break;
349 case ':': 382 case ':':
@@ -529,7 +562,8 @@ int main(int argc, char** argv)
529 current = monotime(); 562 current = monotime();
530 printf("\tdeadline: %" PRIu64 "ns (=%.2fs)\n", 563 printf("\tdeadline: %" PRIu64 "ns (=%.2fs)\n",
531 (uint64_t) cp->deadline, deadline); 564 (uint64_t) cp->deadline, deadline);
532 printf("\tcurrent time: %.2fs, slack: %.2fms\n", 565 printf("\tcurrent time: %.2fs, "
566 "time until deadline: %.2fms\n",
533 current, (deadline - current) * 1000); 567 current, (deadline - current) * 1000);
534 } 568 }
535 if (report_interrupts && cp) { 569 if (report_interrupts && cp) {
@@ -547,7 +581,7 @@ int main(int argc, char** argv)
547 acet = 0; 581 acet = 0;
548 acet *= scale; 582 acet *= scale;
549 if (verbose) 583 if (verbose)
550 printf("\ttarget ACET: %6.2fms (%.2f%% of WCET)\n", 584 printf("\ttarget exec. time: %6.2fms (%.2f%% of WCET)\n",
551 acet * 1000, 585 acet * 1000,
552 (acet * 1000 / wcet_ms) * 100); 586 (acet * 1000 / wcet_ms) * 100);
553 } while (job(acet, start + duration, 587 } while (job(acet, start + duration,