From e349935139d993af3ad26a1cda30cce8dbf794ac Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Wed, 22 Sep 2010 17:42:26 -0400 Subject: Litmus core: add budget_remaining() helper Returns the amount of budget left for a given job. --- include/litmus/litmus.h | 8 ++++++++ 1 file changed, 8 insertions(+) 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) return get_exec_time(t) >= get_exec_cost(t); } +inline static lt_t budget_remaining(struct task_struct* t) +{ + /* This overflows if called when there is no budget remaining. */ + BUG_ON(budget_exhausted(t)); + + return get_exec_cost(t) - get_exec_time(t); +} + #define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT) -- cgit v1.2.2