aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/litmus.h
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-10-18 15:58:27 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-10-19 09:40:39 -0400
commitbf34c69c682443b5bf2f9009b1a0039fd60e654f (patch)
tree6f1b1c8ca9f91ca4245f608dc55194058891e010 /include/litmus/litmus.h
parentbd6d5f1dd586a27c2082ad4d95ee58913b471f5c (diff)
Litmus core: add budget_remaining() helper
Quick way to figure out how much budget a LITMUS^RT job has left.
Diffstat (limited to 'include/litmus/litmus.h')
-rw-r--r--include/litmus/litmus.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h
index 674528eece14..69894f59c8d8 100644
--- a/include/litmus/litmus.h
+++ b/include/litmus/litmus.h
@@ -85,6 +85,15 @@ 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
88inline static lt_t budget_remaining(struct task_struct* t)
89{
90 if (!budget_exhausted(t))
91 return get_exec_time(t) - get_exec_cost(t);
92 else
93 /* avoid overflow */
94 return 0;
95}
96
88#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT) 97#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT)
89 98
90 99