aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2009-04-11 14:34:35 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2009-04-11 14:34:35 -0400
commitef704962284a3b3548a4206f451e63e86a72a77f (patch)
tree2ec6c4cff951b6639e3b44163f4abbc98a4560dc /litmus
parent35a6b23a6e08f665f464bbc6a0d7c231b17cdbff (diff)
litmus core: fix CPU time accounting
Tell Linux how much time each RT task consumed. This fixes the behavior of CPU timers and tools like top.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/sched_litmus.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/litmus/sched_litmus.c b/litmus/sched_litmus.c
index 9274bbe98a..9d802f9efb 100644
--- a/litmus/sched_litmus.c
+++ b/litmus/sched_litmus.c
@@ -5,10 +5,16 @@
5 5
6static void update_time_litmus(struct rq *rq, struct task_struct *p) 6static void update_time_litmus(struct rq *rq, struct task_struct *p)
7{ 7{
8 lt_t now = litmus_clock(); 8 u64 delta = rq->clock - p->se.exec_start;
9 p->rt_param.job_params.exec_time += 9 if (unlikely((s64)delta < 0))
10 now - p->rt_param.job_params.exec_start; 10 delta = 0;
11 p->rt_param.job_params.exec_start = now; 11 /* per job counter */
12 p->rt_param.job_params.exec_time += delta;
13 /* task counter */
14 p->se.sum_exec_runtime += delta;
15 /* sched_clock() */
16 p->se.exec_start = rq->clock;
17 cpuacct_charge(p, delta);
12} 18}
13 19
14static void double_rq_lock(struct rq *rq1, struct rq *rq2); 20static void double_rq_lock(struct rq *rq1, struct rq *rq2);
@@ -174,7 +180,7 @@ static struct task_struct *pick_next_task_litmus(struct rq *rq)
174 struct task_struct* picked = rq->litmus_next; 180 struct task_struct* picked = rq->litmus_next;
175 rq->litmus_next = NULL; 181 rq->litmus_next = NULL;
176 if (picked) 182 if (picked)
177 picked->rt_param.job_params.exec_start = litmus_clock(); 183 picked->se.exec_start = rq->clock;
178 return picked; 184 return picked;
179} 185}
180 186
@@ -189,7 +195,7 @@ static void task_tick_litmus(struct rq *rq, struct task_struct *p)
189 */ 195 */
190static void set_curr_task_litmus(struct rq *rq) 196static void set_curr_task_litmus(struct rq *rq)
191{ 197{
192 rq->curr->rt_param.job_params.exec_start = litmus_clock(); 198 rq->curr->se.exec_start = rq->clock;
193} 199}
194 200
195 201