diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-10-18 15:58:27 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-10-19 09:40:39 -0400 |
commit | bf34c69c682443b5bf2f9009b1a0039fd60e654f (patch) | |
tree | 6f1b1c8ca9f91ca4245f608dc55194058891e010 /include/litmus/litmus.h | |
parent | bd6d5f1dd586a27c2082ad4d95ee58913b471f5c (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.h | 9 |
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 | ||
88 | inline 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 | ||