diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-09-22 17:42:26 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-09-22 17:42:26 -0400 |
commit | e349935139d993af3ad26a1cda30cce8dbf794ac (patch) | |
tree | e6fde5eead2b20e37e6e01efe54f9eadc6a80257 | |
parent | 44c034799bb7a4e8090b5460e36c3993d1924006 (diff) |
Litmus core: add budget_remaining() helper
Returns the amount of budget left for a given job.
-rw-r--r-- | include/litmus/litmus.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index 674528eece14..ba6c5381e151 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h | |||
@@ -85,6 +85,14 @@ inline static int budget_exhausted(struct task_struct* t) | |||
85 | return get_exec_time(t) >= get_exec_cost(t); | 85 | return get_exec_time(t) >= get_exec_cost(t); |
86 | } | 86 | } |
87 | 87 | ||
88 | inline static lt_t budget_remaining(struct task_struct* t) | ||
89 | { | ||
90 | /* This overflows if called when there is no budget remaining. */ | ||
91 | BUG_ON(budget_exhausted(t)); | ||
92 | |||
93 | return get_exec_cost(t) - get_exec_time(t); | ||
94 | } | ||
95 | |||
88 | #define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT) | 96 | #define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT) |
89 | 97 | ||
90 | 98 | ||