aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-02-19 15:51:14 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-02-19 15:51:14 -0500
commit70427f6589c75d2cff7983f93d58a9728d6eebf2 (patch)
tree792b1f8cec453e2aa5400946c041de1115448040
parent423ad81dd18d5e696537bce1bdf5772ad55490ca (diff)
add release_ts utility
-rw-r--r--Makefile5
-rw-r--r--bin/release_ts.c50
2 files changed, 54 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 8ac8f38..fe850a7 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ LIBS= ./liblitmus.a
10LIB_OBJ= litmus.o syscalls.o sched_trace.o task.o kernel_iface.o 10LIB_OBJ= litmus.o syscalls.o sched_trace.o task.o kernel_iface.o
11 11
12TARGETS = run rt_launch liblitmus.a \ 12TARGETS = 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
15vpath %.h include/ 15vpath %.h include/
16vpath %.c src/ bin/ 16vpath %.c src/ bin/
@@ -40,6 +40,9 @@ run: run.o ${LIBS}
40rt_launch: liblitmus.a litmus.h rt_launch.o 40rt_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
43release_ts: liblitmus.a litmus.h release_ts.o
44 cc -static -o release_ts release_ts.o ${LIBS}
45
43stdump: liblitmus.a litmus.h sched_trace.h stdump.o 46stdump: 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
10void 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
19int 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