aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/budget.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/litmus/budget.h')
-rw-r--r--include/litmus/budget.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/litmus/budget.h b/include/litmus/budget.h
index 732530e63491..96da960adccc 100644
--- a/include/litmus/budget.h
+++ b/include/litmus/budget.h
@@ -5,4 +5,23 @@
5 * the next task. */ 5 * the next task. */
6void update_enforcement_timer(struct task_struct* t); 6void update_enforcement_timer(struct task_struct* t);
7 7
8inline static int budget_exhausted(struct task_struct* t)
9{
10 return get_exec_time(t) >= get_exec_cost(t);
11}
12
13inline static lt_t budget_remaining(struct task_struct* t)
14{
15 if (!budget_exhausted(t))
16 return get_exec_cost(t) - get_exec_time(t);
17 else
18 /* avoid overflow */
19 return 0;
20}
21
22#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT)
23
24#define budget_precisely_enforced(t) (tsk_rt(t)->task_params.budget_policy \
25 == PRECISE_ENFORCEMENT)
26
8#endif 27#endif