diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-09-28 16:52:08 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-09-28 16:52:08 -0400 |
commit | fb90f3b6a8a604a9aed7249045bfed77ce42de5b (patch) | |
tree | f66d4c410e2ba637884cb232242cc1f4742d6de1 | |
parent | 9f2cc91ad895214eafafe61eded30ad1c0b145bf (diff) |
Move task time accounting into the complete_job method.wip-rt-kshark
-rw-r--r-- | litmus/jobs.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/litmus/jobs.c b/litmus/jobs.c index 1dc97d32a350..8a0c889e2cb8 100644 --- a/litmus/jobs.c +++ b/litmus/jobs.c | |||
@@ -5,18 +5,13 @@ | |||
5 | 5 | ||
6 | #include <litmus/litmus.h> | 6 | #include <litmus/litmus.h> |
7 | #include <litmus/jobs.h> | 7 | #include <litmus/jobs.h> |
8 | #include <litmus/trace.h> | ||
8 | 9 | ||
9 | static inline void setup_release(struct task_struct *t, lt_t release) | 10 | static inline void setup_release(struct task_struct *t, lt_t release) |
10 | { | 11 | { |
11 | lt_t exec_time = tsk_rt(t)->job_params.exec_time; | ||
12 | |||
13 | tsk_rt(t)->tot_exec_time += exec_time; | ||
14 | if (tsk_rt(t)->max_exec_time < exec_time) | ||
15 | tsk_rt(t)->max_exec_time = exec_time; | ||
16 | |||
17 | /* prepare next release */ | 12 | /* prepare next release */ |
18 | tsk_rt(t)->job_params.release = tsk_rt(t)->job_params.deadline; | 13 | tsk_rt(t)->job_params.release = release; |
19 | tsk_rt(t)->job_params.deadline += get_rt_period(t); | 14 | tsk_rt(t)->job_params.deadline += release + get_rt_period(t); |
20 | tsk_rt(t)->job_params.exec_time = 0; | 15 | tsk_rt(t)->job_params.exec_time = 0; |
21 | /* update job sequence number */ | 16 | /* update job sequence number */ |
22 | tsk_rt(t)->job_params.job_no++; | 17 | tsk_rt(t)->job_params.job_no++; |
@@ -52,6 +47,22 @@ void release_at(struct task_struct *t, lt_t start) | |||
52 | */ | 47 | */ |
53 | long complete_job(void) | 48 | long complete_job(void) |
54 | { | 49 | { |
50 | lt_t amount; | ||
51 | lt_t now = litmus_clock(); | ||
52 | lt_t exec_time = tsk_rt(current)->job_params.exec_time; | ||
53 | |||
54 | tsk_rt(current)->tot_exec_time += exec_time; | ||
55 | if (lt_before(tsk_rt(current)->max_exec_time, exec_time)) | ||
56 | tsk_rt(current)->max_exec_time = exec_time; | ||
57 | |||
58 | if (is_tardy(current, now)) { | ||
59 | amount = now - get_deadline(current); | ||
60 | if (lt_after(amount, tsk_rt(current)->max_tardy)) | ||
61 | tsk_rt(current)->max_tardy = amount; | ||
62 | tsk_rt(current)->total_tardy += amount; | ||
63 | ++tsk_rt(current)->missed; | ||
64 | } | ||
65 | |||
55 | /* Mark that we do not excute anymore */ | 66 | /* Mark that we do not excute anymore */ |
56 | set_rt_flags(current, RT_F_SLEEP); | 67 | set_rt_flags(current, RT_F_SLEEP); |
57 | /* call schedule, this will return when a new job arrives | 68 | /* call schedule, this will return when a new job arrives |