diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-09-23 14:30:19 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-09-23 14:30:19 -0400 |
commit | 0feedf723aaa61958ad81dca9d7135a69220d7b4 (patch) | |
tree | 07d4dd83770934aaf4808e667dc31680ea1dce07 /include | |
parent | e8768d1ca3abd748be9e25c8899b9631c501f00f (diff) |
Fix critical bug in GPU tracker.wip-2012.3-gpu-rtss13
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus/gpu_affinity.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/include/litmus/gpu_affinity.h b/include/litmus/gpu_affinity.h index f610f58b1f3b..197d4438d4f9 100644 --- a/include/litmus/gpu_affinity.h +++ b/include/litmus/gpu_affinity.h | |||
@@ -16,22 +16,33 @@ static inline void reset_gpu_tracker(struct task_struct* t) | |||
16 | 16 | ||
17 | static inline void start_gpu_tracker(struct task_struct* t) | 17 | static inline void start_gpu_tracker(struct task_struct* t) |
18 | { | 18 | { |
19 | t->rt_param.gpu_time_stamp = litmus_clock(); | 19 | lt_t now = litmus_clock(); |
20 | |||
21 | TRACE_TASK(t, "+++ starting gpu tracker @ %llu\n", now); | ||
22 | // WARN_ON(t->rt_param.gpu_time_stamp != 0); // already running! | ||
23 | |||
24 | if (likely(!t->rt_param.gpu_time_stamp)) | ||
25 | t->rt_param.gpu_time_stamp = now; | ||
20 | } | 26 | } |
21 | 27 | ||
22 | static inline void stop_gpu_tracker(struct task_struct* t) | 28 | static inline void stop_gpu_tracker(struct task_struct* t) |
23 | { | 29 | { |
24 | lt_t now = litmus_clock(); | 30 | lt_t now = litmus_clock(); |
25 | t->rt_param.accum_gpu_time += (now - t->rt_param.gpu_time_stamp); | 31 | |
26 | t->rt_param.gpu_time_stamp = 0; | 32 | TRACE_TASK(t, "--- stopping gpu tracker @ %llu\n", now); |
33 | // WARN_ON(t->rt_param.gpu_time_stamp == 0); // already stopped! | ||
34 | |||
35 | if (likely(t->rt_param.gpu_time_stamp)) { | ||
36 | t->rt_param.accum_gpu_time += (now - t->rt_param.gpu_time_stamp); | ||
37 | t->rt_param.gpu_time_stamp = 0; | ||
38 | } | ||
27 | } | 39 | } |
28 | 40 | ||
29 | static inline lt_t get_gpu_time(struct task_struct* t) | 41 | static inline lt_t get_gpu_time(struct task_struct* t) |
30 | { | 42 | { |
31 | lt_t accum = t->rt_param.accum_gpu_time; | 43 | lt_t accum = t->rt_param.accum_gpu_time; |
32 | if (t->rt_param.gpu_time_stamp != 0) { | 44 | if (t->rt_param.gpu_time_stamp != 0) |
33 | accum += (litmus_clock() - t->rt_param.gpu_time_stamp); | 45 | accum += (litmus_clock() - t->rt_param.gpu_time_stamp); |
34 | } | ||
35 | return accum; | 46 | return accum; |
36 | } | 47 | } |
37 | 48 | ||