aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2007-10-28 22:08:32 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2007-10-28 22:08:32 -0400
commit99d81fbfc86fae7f5709e66a6c213195017f5627 (patch)
tree39ed130e765b417ee5d95af243e22e369f8d42da
parent8574756fb52c5feff4c552bdae6c2d8dfab4a0ba (diff)
add stdump filter for adaptive systems2007.2
-rw-r--r--Makefile9
-rw-r--r--include/adaptive.h6
-rw-r--r--src/stdump.c44
3 files changed, 56 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 64d3f25..250820a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ CPPFLAGS=-Wall -g
3 3
4LIBS= ./liblitmus.a 4LIBS= ./liblitmus.a
5 5
6TARGETS = showsched iotest set_rt_mode run timeout rt_launch edfhsb liblitmus.a wait_test np_test 6TARGETS = showsched iotest set_rt_mode run timeout rt_launch edfhsb liblitmus.a wait_test np_test stdump
7 7
8vpath %.h include/ 8vpath %.h include/
9vpath %.c src/ 9vpath %.c src/
@@ -22,7 +22,7 @@ iotest: iotest.o litmus.h liblitmus.a
22 cc -static -o iotest iotest.o ${LIBS} 22 cc -static -o iotest iotest.o ${LIBS}
23 23
24run: run.o 24run: run.o
25 cc -o run run.o 25 cc -o run run.o ${LIBS}
26 26
27set_rt_mode: liblitmus.a set_rt_mode.o 27set_rt_mode: liblitmus.a set_rt_mode.o
28 cc -o set_rt_mode set_rt_mode.o ${LIBS} 28 cc -o set_rt_mode set_rt_mode.o ${LIBS}
@@ -39,5 +39,8 @@ rt_launch: liblitmus.a litmus.h rt_launch.o
39edfhsb: liblitmus.a edf-hsb.o litmus.h edf-hsb.h hrt.o 39edfhsb: liblitmus.a edf-hsb.o litmus.h edf-hsb.h hrt.o
40 cc -o edfhsb hrt.o edf-hsb.o ${LIBS} 40 cc -o edfhsb hrt.o edf-hsb.o ${LIBS}
41 41
42stdump: liblitmus.a litmus.h sched_trace.h stdump.o
43 cc -o stdump stdump.o ${LIBS}
44
42liblitmus.a: litmus.o sched_trace.o adaptive.o adaptive.h litmus.h edf-hsb.o edf-hsb.h 45liblitmus.a: litmus.o sched_trace.o adaptive.o adaptive.h litmus.h edf-hsb.o edf-hsb.h
43 ${AR} rcs liblitmus.a litmus.o adaptive.o edf-hsb.o 46 ${AR} rcs liblitmus.a litmus.o adaptive.o edf-hsb.o sched_trace.o
diff --git a/include/adaptive.h b/include/adaptive.h
index 8902da5..360b13e 100644
--- a/include/adaptive.h
+++ b/include/adaptive.h
@@ -12,6 +12,12 @@ static inline fp_t f2fp(double f)
12 return (fp_t) {f * (1 << FP_SHIFT)}; 12 return (fp_t) {f * (1 << FP_SHIFT)};
13} 13}
14 14
15static inline double fp2f(fp_t f)
16{
17 return ((double) f.val) / (1 << FP_SHIFT);
18}
19
20
15#define MAX_SERVICE_LEVELS 10 21#define MAX_SERVICE_LEVELS 10
16typedef struct { 22typedef struct {
17 fp_t weight; 23 fp_t weight;
diff --git a/src/stdump.c b/src/stdump.c
new file mode 100644
index 0000000..282fb31
--- /dev/null
+++ b/src/stdump.c
@@ -0,0 +1,44 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4
5
6#include "litmus.h"
7#include "adaptive.h"
8#include "sched_trace.h"
9
10int show_sl_chg(trace_header_t* hdr)
11{
12 service_level_change_record_t *rec;
13
14 rec = (service_level_change_record_t*) hdr;
15 printf("SL CHANGE : PID=%d PERIOD=%lu\n", rec->task.pid,
16 rec->new_level.period);
17 return 0;
18}
19
20int show_weight_error(trace_header_t* hdr)
21{
22 weight_error_record_t *rec;
23
24 rec = (weight_error_record_t*) hdr;
25 printf("WEIGHT ERR: PID=%d EST=%5.4f ACT=%5.4f\n", rec->task,
26 fp2f(rec->estimate), fp2f(rec->actual));
27 return 0;
28}
29
30
31int main(int argc, char** argv)
32{
33 record_callback_t cb;
34 int ret;
35
36 init_record_callback(&cb);
37 set_callback(ST_SERVICE_LEVEL_CHANGE, show_sl_chg, &cb);
38 set_callback(ST_WEIGHT_ERROR, show_weight_error, &cb);
39
40 ret = walk_sched_trace_files_ordered(argv + 1, argc - 1, 0, &cb);
41 if (ret != 0)
42 perror("walk failed");
43 return 0;
44}