diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-02-17 12:06:19 -0500 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-03-08 10:37:12 -0500 |
commit | 0d733e2d2229ffd3dde05a324227ee45e0f37c44 (patch) | |
tree | e03ca1214c2bc011871e8078059613da9cbcdf47 | |
parent | 322eaadaa95b4f64f4102a9bc6aaa2237401ae41 (diff) |
release_t: add -W option
-rw-r--r-- | bin/release_ts.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/bin/release_ts.c b/bin/release_ts.c index feca5ef..661099e 100644 --- a/bin/release_ts.c +++ b/bin/release_ts.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include "litmus.h" | 9 | #include "litmus.h" |
10 | #include "internal.h" | 10 | #include "internal.h" |
11 | 11 | ||
12 | #define OPTSTR "d:wf:" | 12 | #define OPTSTR "d:wf:W" |
13 | 13 | ||
14 | #define LITMUS_STATS_FILE "/proc/litmus/stats" | 14 | #define LITMUS_STATS_FILE "/proc/litmus/stats" |
15 | 15 | ||
@@ -22,6 +22,7 @@ void usage(char *error) { | |||
22 | " -w wait until all tasks are ready for release\n" | 22 | " -w wait until all tasks are ready for release\n" |
23 | " (as determined by /proc/litmus/stats\n" | 23 | " (as determined by /proc/litmus/stats\n" |
24 | " -f <#tasks> wait for #tasks (default: 0)\n" | 24 | " -f <#tasks> wait for #tasks (default: 0)\n" |
25 | " -W just wait, don't actually release tasks\n" | ||
25 | "\n", | 26 | "\n", |
26 | error); | 27 | error); |
27 | exit(1); | 28 | exit(1); |
@@ -46,8 +47,9 @@ int main(int argc, char** argv) | |||
46 | lt_t delay = ms2ns(1000); | 47 | lt_t delay = ms2ns(1000); |
47 | int wait = 0; | 48 | int wait = 0; |
48 | int expected = 0; | 49 | int expected = 0; |
50 | int exit_after_wait = 0; | ||
49 | int opt; | 51 | int opt; |
50 | 52 | ||
51 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { | 53 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { |
52 | switch (opt) { | 54 | switch (opt) { |
53 | case 'd': | 55 | case 'd': |
@@ -56,6 +58,10 @@ int main(int argc, char** argv) | |||
56 | case 'w': | 58 | case 'w': |
57 | wait = 1; | 59 | wait = 1; |
58 | break; | 60 | break; |
61 | case 'W': | ||
62 | wait = 1; | ||
63 | exit_after_wait = 1; | ||
64 | break; | ||
59 | case 'f': | 65 | case 'f': |
60 | wait = 1; | 66 | wait = 1; |
61 | expected = atoi(optarg); | 67 | expected = atoi(optarg); |
@@ -73,12 +79,15 @@ int main(int argc, char** argv) | |||
73 | if (wait) | 79 | if (wait) |
74 | wait_until_ready(expected); | 80 | wait_until_ready(expected); |
75 | 81 | ||
82 | if (exit_after_wait) | ||
83 | exit(0); | ||
84 | |||
76 | released = release_ts(&delay); | 85 | released = release_ts(&delay); |
77 | if (released < 0) { | 86 | if (released < 0) { |
78 | perror("release task system"); | 87 | perror("release task system"); |
79 | exit(1); | 88 | exit(1); |
80 | } | 89 | } |
81 | 90 | ||
82 | printf("Released %d real-time tasks.\n", released); | 91 | printf("Released %d real-time tasks.\n", released); |
83 | 92 | ||
84 | return 0; | 93 | return 0; |