blob: a2abc4c1fd7c12ac68ee7335189c8d44959ca614 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef LITMUS_GPU_AFFINITY_H
#define LITMUS_GPU_AFFINITY_H
#include <litmus/rt_param.h>
#include <litmus/sched_plugin.h>
#include <litmus/litmus.h>
void update_gpu_estimate(struct task_struct* t, lt_t observed);
gpu_migration_dist_t gpu_migration_distance(int a, int b);
static inline void reset_gpu_tracker(struct task_struct* t)
{
t->rt_param.accum_gpu_time = 0;
}
static inline void start_gpu_tracker(struct task_struct* t)
{
t->rt_param.gpu_time_stamp = litmus_clock();
}
static inline void stop_gpu_tracker(struct task_struct* t)
{
lt_t now = litmus_clock();
t->rt_param.accum_gpu_time += (now - t->rt_param.gpu_time_stamp);
}
static inline lt_t get_gpu_time(struct task_struct* t)
{
return t->rt_param.accum_gpu_time;
}
static inline lt_t get_gpu_estimate(struct task_struct* t, gpu_migration_dist_t dist)
{
lt_t val = 0;
switch(t->rt_param.prediction_mode) {
case SIMPLE_AVG:
case CC_BRUTE_AVG:
case CC_MR_AVG:
val = t->rt_param.gpu_avg_est[dist].center_line;
break;
case SIMPLE_EWMA:
case CC_BRUTE_EWMA:
case CC_MR_EWMA:
val = t->rt_param.gpu_ewma_est[dist].center_line;
break;
}
return ((val > 0) ? val : dist+1);
}
#endif
|