#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