aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2007-09-18 12:23:43 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2007-09-18 12:23:43 -0400
commit957ad72229186c5d21e44366f61d58a4dfa89bfe (patch)
tree2284b3f2f4c1ed7c81ba0ccda720997fab4dab85 /include
parent5760b6ad37c794a0dd5312206184d0b8ae8e8eda (diff)
Change liblitmus to have a more sane repository layout.
Diffstat (limited to 'include')
-rw-r--r--include/edf-hsb.h10
-rw-r--r--include/litmus.h107
-rw-r--r--include/logformat.h112
3 files changed, 229 insertions, 0 deletions
diff --git a/include/edf-hsb.h b/include/edf-hsb.h
new file mode 100644
index 0000000..0ac3d4f
--- /dev/null
+++ b/include/edf-hsb.h
@@ -0,0 +1,10 @@
1#ifndef EDF_HSB_H
2#define EDF_HSB_H
3
4
5int set_hrt(int cpu, unsigned int wcet, unsigned int period);
6int get_hrt(int cpu, unsigned int *wcet, unsigned int *period);
7int create_be(unsigned int wcet, unsigned int period);
8
9
10#endif
diff --git a/include/litmus.h b/include/litmus.h
new file mode 100644
index 0000000..88b0f0b
--- /dev/null
+++ b/include/litmus.h
@@ -0,0 +1,107 @@
1#ifndef LITMUS_H
2#define LITMUS_H
3
4#include <sys/types.h>
5
6/* This flag is needed to start new RT tasks in STOPPED state */
7/* Task is going to run in realtime mode */
8#define CLONE_REALTIME 0x10000000
9
10typedef int (*rt_fn_t)(void*);
11
12/* Litmus scheduling policies */
13typedef enum {
14 SCHED_LINUX = 0,
15 SCHED_PFAIR = 1,
16 SCHED_PFAIR_STAGGER = 2,
17 SCHED_PART_EDF = 3,
18 SCHED_PART_EEVDF = 4,
19 SCHED_GLOBAL_EDF = 5,
20 SCHED_PFAIR_DESYNC = 6,
21 SCHED_GLOBAL_EDF_NP = 7,
22 SCHED_CUSTOM = 8,
23 SCHED_EDF_HSB = 9,
24 SCHED_GSN_EDF = 10,
25 SCHED_PSN_EDF = 11
26} spolicy;
27
28/* different types of clients */
29typedef enum {
30 RT_CLASS_HARD,
31 RT_CLASS_SOFT,
32 RT_CLASS_BEST_EFFORT
33} task_class_t;
34
35/* Task RT params for schedulers */
36/* RT task parameters for scheduling extensions
37* These parameters are inherited during clone and therefore must
38* be explicitly set up before the task set is launched.
39*/
40typedef struct rt_param {
41 /* Execution cost */
42 unsigned long exec_cost;
43 /* Period */
44 unsigned long period;
45 /* Partition */
46 unsigned int cpu;
47 /* type of task */
48 task_class_t cls;
49} rt_param_t;
50
51typedef int sema_id; /* ID of a semaphore in the Linux kernel */
52typedef int pi_sema_id; /* ID of a PI semaphore in the Linux kernel */
53typedef int srp_sema_id; /* ID of an SRP "semaphore" in the Linux kernel */
54
55typedef int pid_t; /* PID of a task */
56
57#define set_param(t,p,e) do{\
58 (t).is_realtime=1;\
59 (t).exec_cost=(e);\
60 (t).period=(p);\
61 }while(0);
62
63/* scheduler modes */
64#define MODE_NON_RT 0
65#define MODE_RT_RUN 1
66
67spolicy sched_setpolicy(spolicy policy);
68spolicy sched_getpolicy(void);
69int set_rt_mode(int mode);
70int set_rt_task_param(pid_t pid, rt_param_t* param);
71int get_rt_task_param(pid_t pid, rt_param_t* param);
72int prepare_rt_task(pid_t pid);
73int tear_down_task(pid_t pid, int sig);
74int reset_stat(void);
75int sleep_next_period(void);
76int scheduler_setup(int cmd, void* param);
77int pi_sema_init(void);
78int pi_down(pi_sema_id sem_id);
79int pi_up(pi_sema_id sem_id);
80int pi_sema_free(pi_sema_id sem_id);
81int sema_init(void);
82int down(sema_id sem_id);
83int up(sema_id sem_id);
84int sema_free(sema_id sem_id);
85int srp_sema_init(void);
86int srp_down(srp_sema_id sem_id);
87int srp_up(srp_sema_id sem_id);
88int reg_task_srp_sem(srp_sema_id sem_id, pid_t t_pid);
89int srp_sema_free(srp_sema_id sem_id);
90int get_job_no(unsigned int* job_no);
91int wait_for_job_release(unsigned int job_no);
92
93/* library functions */
94void init_litmus(void);
95
96int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period);
97int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet,
98 int period, task_class_t cls);
99const char* get_scheduler_name(spolicy scheduler);
100void show_rt_param(rt_param_t* tp);
101task_class_t str2class(const char* str);
102
103void enter_np(void);
104void exit_np(void);
105
106
107#endif
diff --git a/include/logformat.h b/include/logformat.h
new file mode 100644
index 0000000..3a74bf7
--- /dev/null
+++ b/include/logformat.h
@@ -0,0 +1,112 @@
1#ifndef LOGFORMAT_H
2#define LOGFORMAT_H
3
4#include <linux/types.h>
5
6#include "litmus.h"
7
8typedef __u8 u8;
9typedef __u32 u32;
10typedef __u16 u16;
11
12typedef enum {
13 ST_INVOCATION = 0,
14 ST_ARRIVAL = 1,
15 ST_DEPARTURE = 2,
16 ST_PREEMPTION = 3,
17 ST_SCHEDULED = 4,
18 ST_JOB_RELEASE = 5,
19 ST_JOB_COMPLETION = 6,
20 ST_CAPACITY_RELEASE = 7,
21 ST_CAPACITY_ALLOCATION = 8,
22 ST_LAST_TYPE = 8
23} trace_type_t;
24
25typedef struct {
26 trace_type_t trace:8;
27 unsigned long long timestamp;
28} trace_header_t;
29
30
31typedef struct {
32 unsigned int is_rt:1;
33 unsigned int is_server:1;
34 task_class_t cls:4;
35 unsigned int budget:24;
36 u32 deadline;
37
38 pid_t pid;
39} task_info_t;
40
41typedef struct {
42 trace_header_t header;
43 unsigned long flags;
44} invocation_record_t;
45
46typedef struct {
47 trace_header_t header;
48 task_info_t task;
49} arrival_record_t;
50
51typedef struct {
52 trace_header_t header;
53 task_info_t task;
54} departure_record_t;
55
56typedef struct {
57 trace_header_t header;
58 task_info_t task;
59 task_info_t by;
60} preemption_record_t;
61
62typedef struct {
63 trace_header_t header;
64 task_info_t task;
65} scheduled_record_t;
66
67typedef struct {
68 trace_header_t header;
69 task_info_t task;
70 u16 period;
71 u16 wcet;
72} release_record_t;
73
74typedef struct {
75 trace_header_t header;
76 task_info_t task;
77 u16 period;
78 u16 wcet;
79 int tardiness;
80} completion_record_t;
81
82typedef struct {
83 trace_header_t header;
84 task_info_t task;
85} cap_release_record_t;
86
87typedef struct {
88 trace_header_t header;
89 task_info_t task;
90 u16 budget;
91 u32 deadline;
92 pid_t donor;
93} cap_allocation_record_t;
94
95
96typedef union {
97 trace_header_t header;
98 invocation_record_t invocation;
99 arrival_record_t arrival;
100 preemption_record_t preemption;
101 scheduled_record_t scheduled;
102
103 release_record_t release;
104 completion_record_t completion;
105
106 cap_release_record_t cap_release;
107 cap_allocation_record_t cap_alloc;
108} trace_record_t;
109
110
111
112#endif