diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-04 15:43:26 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-04 15:43:26 -0500 |
commit | 005115e1da60fee3ee01d320fe1de4645cc95bfd (patch) | |
tree | 020f0a557656ff3c3cf7b6ad9286ec85b8df9cf8 /bin | |
parent | 1a9b44a9c6ba2b6c089e1ec73905d117b9e25714 (diff) |
change to nanosecond resolution time accounting
Diffstat (limited to 'bin')
-rw-r--r-- | bin/rt_launch.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/bin/rt_launch.c b/bin/rt_launch.c index 186c0fa..94d2dec 100644 --- a/bin/rt_launch.c +++ b/bin/rt_launch.c | |||
@@ -30,14 +30,16 @@ void usage(char *error) { | |||
30 | "\nExamples:" | 30 | "\nExamples:" |
31 | "\n\trt_launch -p 2 10 100 cpu_job" | 31 | "\n\trt_launch -p 2 10 100 cpu_job" |
32 | "\n\t => Launch cpu_job a hard real-time task with " | 32 | "\n\t => Launch cpu_job a hard real-time task with " |
33 | "\n\t period 100 and weight 0.1 on CPU 2.\n" | 33 | "\n\t period 100ms and weight 0.1 on CPU 2.\n" |
34 | "\n\n", | 34 | "\n\n", |
35 | error); | 35 | error); |
36 | exit(1); | 36 | exit(1); |
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | ||
40 | #define OPTSTR "p:c:" | 40 | #define OPTSTR "p:c:v" |
41 | |||
42 | #define NS_PER_MS 1000000 | ||
41 | 43 | ||
42 | int main(int argc, char** argv) | 44 | int main(int argc, char** argv) |
43 | { | 45 | { |
@@ -46,11 +48,15 @@ int main(int argc, char** argv) | |||
46 | int period; | 48 | int period; |
47 | int cpu = 0; | 49 | int cpu = 0; |
48 | int opt; | 50 | int opt; |
51 | int verbose = 0; | ||
49 | startup_info_t info; | 52 | startup_info_t info; |
50 | task_class_t class = RT_CLASS_HARD; | 53 | task_class_t class = RT_CLASS_HARD; |
51 | 54 | ||
52 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { | 55 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { |
53 | switch (opt) { | 56 | switch (opt) { |
57 | case 'v': | ||
58 | verbose = 1; | ||
59 | break; | ||
54 | case 'p': | 60 | case 'p': |
55 | cpu = atoi(optarg); | 61 | cpu = atoi(optarg); |
56 | break; | 62 | break; |
@@ -74,8 +80,8 @@ int main(int argc, char** argv) | |||
74 | 80 | ||
75 | if (argc - optind < 3) | 81 | if (argc - optind < 3) |
76 | usage("Arguments missing."); | 82 | usage("Arguments missing."); |
77 | wcet = atoi(argv[optind + 0]); | 83 | wcet = atoi(argv[optind + 0]) * NS_PER_MS; |
78 | period = atoi(argv[optind + 1]); | 84 | period = atoi(argv[optind + 1]) * NS_PER_MS; |
79 | if (wcet <= 0) | 85 | if (wcet <= 0) |
80 | usage("The worst-case execution time must be a " | 86 | usage("The worst-case execution time must be a " |
81 | "positive number."); | 87 | "positive number."); |
@@ -92,8 +98,9 @@ int main(int argc, char** argv) | |||
92 | 98 | ||
93 | if (ret < 0) { | 99 | if (ret < 0) { |
94 | perror("Could not create rt child process"); | 100 | perror("Could not create rt child process"); |
95 | return 2; | 101 | return 2; |
96 | } | 102 | } else if (verbose) |
103 | printf("%d\n", ret); | ||
97 | 104 | ||
98 | return 0; | 105 | return 0; |
99 | } | 106 | } |