diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-09-03 08:51:31 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-10-18 16:14:03 -0400 |
commit | 00b4b17dc1f65a1e5de4648200c826cc2eef37f4 (patch) | |
tree | 5341b3d1c95d8b2efb53f3d6493c7bba3fbd2e07 | |
parent | 173e46b1ea0305ab74ab8e6a4b4461e296b83922 (diff) |
Use user-provided irq count for TS_SYSCALL_IN_END
To detect interrupts that interfered after the initial time stamp was
recorded, this patch changes sched_trace to also record the IRQ count
as observed by userspace.
-rw-r--r-- | include/litmus/litmus.h | 19 | ||||
-rw-r--r-- | include/litmus/trace.h | 8 | ||||
-rw-r--r-- | litmus/trace.c | 21 |
3 files changed, 47 insertions, 1 deletions
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index f7893ef18162..1cb3eaf25740 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h | |||
@@ -270,9 +270,28 @@ static inline int has_control_page(struct task_struct* t) | |||
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | #ifdef CONFIG_SCHED_OVERHEAD_TRACE | ||
274 | |||
273 | #define TS_SYSCALL_IN_START \ | 275 | #define TS_SYSCALL_IN_START \ |
274 | if (has_control_page(current)) { \ | 276 | if (has_control_page(current)) { \ |
275 | __TS_SYSCALL_IN_START(&get_control_page(current)->ts_syscall_start); \ | 277 | __TS_SYSCALL_IN_START(&get_control_page(current)->ts_syscall_start); \ |
276 | } | 278 | } |
277 | 279 | ||
280 | #define TS_SYSCALL_IN_END \ | ||
281 | if (has_control_page(current)) { \ | ||
282 | uint64_t irqs; \ | ||
283 | local_irq_disable(); \ | ||
284 | irqs = get_control_page(current)->irq_count - \ | ||
285 | get_control_page(current)->irq_syscall_start; \ | ||
286 | __TS_SYSCALL_IN_END(&irqs); \ | ||
287 | local_irq_enable(); \ | ||
288 | } | ||
289 | |||
290 | #else | ||
291 | |||
292 | #define TS_SYSCALL_IN_START | ||
293 | #define TS_SYSCALL_IN_END | ||
294 | |||
295 | #endif | ||
296 | |||
278 | #endif | 297 | #endif |
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index ee55c2eca482..635dd8986bd4 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -34,6 +34,7 @@ feather_callback void save_timestamp_task(unsigned long event, unsigned long t_p | |||
34 | feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu); | 34 | feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu); |
35 | feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr); | 35 | feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr); |
36 | feather_callback void save_timestamp_time(unsigned long event, unsigned long time_ptr); | 36 | feather_callback void save_timestamp_time(unsigned long event, unsigned long time_ptr); |
37 | feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_count_ptr); | ||
37 | 38 | ||
38 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) | 39 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) |
39 | 40 | ||
@@ -53,6 +54,9 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim | |||
53 | #define TIMESTAMP_TIME(id, time_ptr) \ | 54 | #define TIMESTAMP_TIME(id, time_ptr) \ |
54 | ft_event1(id, save_timestamp_time, (unsigned long) time_ptr) | 55 | ft_event1(id, save_timestamp_time, (unsigned long) time_ptr) |
55 | 56 | ||
57 | #define TIMESTAMP_IRQ(id, irq_count_ptr) \ | ||
58 | ft_event1(id, save_timestamp_irq, (unsigned long) irq_count_ptr) | ||
59 | |||
56 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ | 60 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ |
57 | 61 | ||
58 | #define TIMESTAMP(id) /* no tracing */ | 62 | #define TIMESTAMP(id) /* no tracing */ |
@@ -69,6 +73,8 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim | |||
69 | 73 | ||
70 | #define TIMESTAMP_TIME(id, time_ptr) /* no tracing */ | 74 | #define TIMESTAMP_TIME(id, time_ptr) /* no tracing */ |
71 | 75 | ||
76 | #define TIMESTAMP_IRQ(id, irq_count_ptr) /* no tracing */ | ||
77 | |||
72 | #endif | 78 | #endif |
73 | 79 | ||
74 | 80 | ||
@@ -81,7 +87,7 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim | |||
81 | */ | 87 | */ |
82 | 88 | ||
83 | #define __TS_SYSCALL_IN_START(p) TIMESTAMP_TIME(10, p) | 89 | #define __TS_SYSCALL_IN_START(p) TIMESTAMP_TIME(10, p) |
84 | #define TS_SYSCALL_IN_END TIMESTAMP_CUR(11) | 90 | #define __TS_SYSCALL_IN_END(p) TIMESTAMP_IRQ(11, p) |
85 | 91 | ||
86 | #define TS_SYSCALL_OUT_START TIMESTAMP_CUR(20) | 92 | #define TS_SYSCALL_OUT_START TIMESTAMP_CUR(20) |
87 | #define TS_SYSCALL_OUT_END TIMESTAMP_CUR(21) | 93 | #define TS_SYSCALL_OUT_END TIMESTAMP_CUR(21) |
diff --git a/litmus/trace.c b/litmus/trace.c index c511003ea911..45cd662c021d 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -166,6 +166,27 @@ void save_timestamp_time(unsigned long event, | |||
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | /* Record user-reported IRQ count */ | ||
170 | void save_timestamp_irq(unsigned long event, | ||
171 | unsigned long irq_counter_ptr) | ||
172 | { | ||
173 | uint64_t* irqs = (uint64_t*) irq_counter_ptr; | ||
174 | unsigned int seq_no; | ||
175 | struct timestamp *ts; | ||
176 | seq_no = fetch_and_inc((int *) &ts_seq_no); | ||
177 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { | ||
178 | ts->event = event; | ||
179 | ts->seq_no = seq_no; | ||
180 | ts->pid = current->pid; | ||
181 | ts->cpu = raw_smp_processor_id(); | ||
182 | ts->task_type = is_realtime(current) ? TSK_RT : TSK_BE; | ||
183 | ts->irq_count = *irqs; | ||
184 | ts->irq_flag = *irqs > 0; | ||
185 | ts->timestamp = ft_timestamp(); | ||
186 | ft_buffer_finish_write(trace_ts_buf, ts); | ||
187 | } | ||
188 | } | ||
189 | |||
169 | /******************************************************************************/ | 190 | /******************************************************************************/ |
170 | /* DEVICE FILE DRIVER */ | 191 | /* DEVICE FILE DRIVER */ |
171 | /******************************************************************************/ | 192 | /******************************************************************************/ |