aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--np_test.c56
2 files changed, 62 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 18a3c82..765ebde 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,19 @@
1CFLAGS=-Wall -g 1CFLAGS=-Wall -g
2CPPFLAGS=-Wall -g 2CPPFLAGS=-Wall -g
3 3
4TARGETS = showsched iotest set_rt_mode run timeout rt_launch edfhsb liblitmus.a wait_test np_test
4 5
5all: showsched iotest set_rt_mode run timeout rt_launch edfhsb liblitmus.a wait_test
6 6
7all: ${TARGETS}
7clean: 8clean:
8 rm *.o showsched iotest set_rt_mode run timeout rt_launch edfhsb liblitmus.a wait_test 9 rm *.o ${TARGETS}
9 10
10wait_test: wait_test.o litmus.h litmus.o 11wait_test: wait_test.o litmus.h litmus.o
11 cc -static -o wait_test litmus.o wait_test.o 12 cc -static -o wait_test litmus.o wait_test.o
12 13
14np_test: np_test.o litmus.h litmus.o
15 cc -static -o np_test litmus.o np_test.o
16
13iotest: iotest.o litmus.h litmus.o 17iotest: iotest.o litmus.h litmus.o
14 cc -static -o iotest litmus.o iotest.o 18 cc -static -o iotest litmus.o iotest.o
15 19
diff --git a/np_test.c b/np_test.c
new file mode 100644
index 0000000..dad68aa
--- /dev/null
+++ b/np_test.c
@@ -0,0 +1,56 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <signal.h>
4#include <unistd.h>
5#include <sys/time.h>
6#include <sys/wait.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <fcntl.h>
10
11#include "litmus.h"
12
13#define US_PER_MS 1000
14
15#define NUMTASKS 4
16
17int prefix(void)
18{
19 char field[1024];
20 int prefix[1024];
21 int i, sum = 0;
22
23 for (i = 0; i < 1024; i++) {
24 sum += field[i];
25 prefix[i] = sum;
26 }
27 return sum;
28}
29
30
31void do_stuff(void)
32{
33 int i =0, j =0;
34
35 for (; i < 50000; i++)
36 j += prefix();
37}
38
39#define CALL(sc) do { ret = sc; if (ret == -1) {perror(" (!!) " #sc " failed: "); /*exit(1)*/;}} while (0);
40
41
42int main(int argc, char** argv)
43{
44 int ret;
45
46 init_litmus();
47
48 enter_np();
49
50 do_stuff();
51
52 exit_np();
53
54
55 return 0;
56}