diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-10-07 12:46:19 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-10-07 12:46:19 -0400 |
commit | 73a7cc545924670df00abb7576fdb4bbc993bb38 (patch) | |
tree | 820188e7d15a8679a901ff67b374627d1b9856bb /include/adaptive.h | |
parent | 9de8f0850ce4b34a849384d119fc9e5a6f3f8d17 (diff) |
adaptive: implement proper kernel interface
Update syscalls, implement fixed-point parameter support.
Diffstat (limited to 'include/adaptive.h')
-rw-r--r-- | include/adaptive.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/include/adaptive.h b/include/adaptive.h index a67c540..21e1dfd 100644 --- a/include/adaptive.h +++ b/include/adaptive.h | |||
@@ -1,23 +1,35 @@ | |||
1 | #ifndef ADAPTIVE_H | 1 | #ifndef ADAPTIVE_H |
2 | #define ADAPTIVE_H | 2 | #define ADAPTIVE_H |
3 | 3 | ||
4 | #define MAX_SERVICE_LEVELS 10 | 4 | #define FP_SHIFT 16 |
5 | typedef struct | ||
6 | { | ||
7 | long long val; | ||
8 | } fp_t; | ||
9 | |||
10 | static inline fp_t f2fp(double f) | ||
11 | { | ||
12 | return (fp_t) {f * (1 << FP_SHIFT)}; | ||
13 | } | ||
5 | 14 | ||
15 | #define MAX_SERVICE_LEVELS 10 | ||
6 | typedef struct { | 16 | typedef struct { |
7 | unsigned long exec_cost; | 17 | fp_t weight; |
8 | unsigned long period; | 18 | unsigned long period; |
9 | /* fixed point */ | 19 | fp_t value; |
10 | unsigned long utility; | ||
11 | } service_level_t; | 20 | } service_level_t; |
12 | 21 | ||
13 | int set_service_levels(pid_t pid, | 22 | int set_service_levels(pid_t pid, |
14 | unsigned int nr_levels, | 23 | unsigned int nr_levels, |
15 | service_level_t* levels); | 24 | service_level_t* levels, |
25 | fp_t *wt_y, | ||
26 | fp_t *wt_slope); | ||
16 | 27 | ||
17 | int get_cur_service_level(void); | 28 | int get_cur_service_level(void); |
18 | 29 | ||
19 | int create_adaptive_rt_task(rt_fn_t rt_prog, void *arg, | 30 | int create_adaptive_rt_task(rt_fn_t rt_prog, void *arg, |
20 | unsigned int no_levels, service_level_t* levels); | 31 | unsigned int no_levels, service_level_t* levels, |
32 | fp_t wt_y, fp_t wt_slope); | ||
21 | 33 | ||
22 | 34 | ||
23 | #endif | 35 | #endif |