aboutsummaryrefslogtreecommitdiffstats
path: root/include/adaptive.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/adaptive.h')
-rw-r--r--include/adaptive.h24
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
5typedef struct
6{
7 long long val;
8} fp_t;
9
10static inline fp_t f2fp(double f)
11{
12 return (fp_t) {f * (1 << FP_SHIFT)};
13}
5 14
15#define MAX_SERVICE_LEVELS 10
6typedef struct { 16typedef 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
13int set_service_levels(pid_t pid, 22int 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
17int get_cur_service_level(void); 28int get_cur_service_level(void);
18 29
19int create_adaptive_rt_task(rt_fn_t rt_prog, void *arg, 30int 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