diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-19 15:51:14 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-19 15:51:14 -0500 |
commit | 70427f6589c75d2cff7983f93d58a9728d6eebf2 (patch) | |
tree | 792b1f8cec453e2aa5400946c041de1115448040 | |
parent | 423ad81dd18d5e696537bce1bdf5772ad55490ca (diff) |
add release_ts utility
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | bin/release_ts.c | 50 |
2 files changed, 54 insertions, 1 deletions
@@ -10,7 +10,7 @@ LIBS= ./liblitmus.a | |||
10 | LIB_OBJ= litmus.o syscalls.o sched_trace.o task.o kernel_iface.o | 10 | LIB_OBJ= litmus.o syscalls.o sched_trace.o task.o kernel_iface.o |
11 | 11 | ||
12 | TARGETS = run rt_launch liblitmus.a \ | 12 | TARGETS = run rt_launch liblitmus.a \ |
13 | wait_test np_test stdump mode_test base_task base_mt_task | 13 | wait_test np_test stdump mode_test base_task base_mt_task release_ts |
14 | 14 | ||
15 | vpath %.h include/ | 15 | vpath %.h include/ |
16 | vpath %.c src/ bin/ | 16 | vpath %.c src/ bin/ |
@@ -40,6 +40,9 @@ run: run.o ${LIBS} | |||
40 | rt_launch: liblitmus.a litmus.h rt_launch.o | 40 | rt_launch: liblitmus.a litmus.h rt_launch.o |
41 | cc -static -o rt_launch rt_launch.o ${LIBS} | 41 | cc -static -o rt_launch rt_launch.o ${LIBS} |
42 | 42 | ||
43 | release_ts: liblitmus.a litmus.h release_ts.o | ||
44 | cc -static -o release_ts release_ts.o ${LIBS} | ||
45 | |||
43 | stdump: liblitmus.a litmus.h sched_trace.h stdump.o | 46 | stdump: liblitmus.a litmus.h sched_trace.h stdump.o |
44 | cc -o stdump stdump.o ${LIBS} | 47 | cc -o stdump stdump.o ${LIBS} |
45 | 48 | ||
diff --git a/bin/release_ts.c b/bin/release_ts.c new file mode 100644 index 0000000..4d4c9e8 --- /dev/null +++ b/bin/release_ts.c | |||
@@ -0,0 +1,50 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <stdio.h> | ||
3 | #include <unistd.h> | ||
4 | |||
5 | #include "litmus.h" | ||
6 | |||
7 | #define OPTSTR "d:" | ||
8 | #define NS_PER_MS 1000000 | ||
9 | |||
10 | void usage(char *error) { | ||
11 | fprintf(stderr, | ||
12 | "%s\n" | ||
13 | "Usage: release_ts [-d <delay in ms>]\n", | ||
14 | error); | ||
15 | exit(1); | ||
16 | } | ||
17 | |||
18 | |||
19 | int main(int argc, char** argv) | ||
20 | { | ||
21 | int released; | ||
22 | lt_t delay = ms2lt(1000); | ||
23 | int opt; | ||
24 | |||
25 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { | ||
26 | switch (opt) { | ||
27 | case 'd': | ||
28 | delay = ms2lt(atoi(optarg)); | ||
29 | break; | ||
30 | case ':': | ||
31 | usage("Argument missing."); | ||
32 | break; | ||
33 | case '?': | ||
34 | default: | ||
35 | usage("Bad argument."); | ||
36 | break; | ||
37 | } | ||
38 | } | ||
39 | |||
40 | released = release_ts(&delay); | ||
41 | if (released < 0) { | ||
42 | perror("release task system"); | ||
43 | exit(1); | ||
44 | } | ||
45 | |||
46 | printf("Released %d real-time tasks.\n", released); | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | |||