diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-09-04 08:39:09 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-10-18 16:14:05 -0400 |
commit | a481c27ddd7d324a9f311ae9a08228499dbb7f7b (patch) | |
tree | 09e380e77ba71a44d3a5c2d9c5144e90d005a439 | |
parent | a13904d4b6d04278deb6841020dd7dee9867745e (diff) |
Feather-Trace: hide irq in SEND_RESCHED_END
SEND_RESCHED_END is necessarily preceded by an interrupt. We don't
want to filter events based on this expected interrupts, but we still
want to detect samples disturbed by other interrupts. Hence, subtract
one off the interrupt count.
-rw-r--r-- | include/litmus/trace.h | 8 | ||||
-rw-r--r-- | litmus/trace.c | 32 |
2 files changed, 29 insertions, 11 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index 635dd8986bd4..8ad4966c602e 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -35,6 +35,7 @@ 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 | feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_count_ptr); |
38 | feather_callback void save_timestamp_hide_irq(unsigned long event); | ||
38 | 39 | ||
39 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) | 40 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) |
40 | 41 | ||
@@ -57,6 +58,9 @@ feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_ | |||
57 | #define TIMESTAMP_IRQ(id, irq_count_ptr) \ | 58 | #define TIMESTAMP_IRQ(id, irq_count_ptr) \ |
58 | ft_event1(id, save_timestamp_irq, (unsigned long) irq_count_ptr) | 59 | ft_event1(id, save_timestamp_irq, (unsigned long) irq_count_ptr) |
59 | 60 | ||
61 | #define TIMESTAMP_IN_IRQ(id) \ | ||
62 | ft_event0(id, save_timestamp_hide_irq) | ||
63 | |||
60 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ | 64 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ |
61 | 65 | ||
62 | #define TIMESTAMP(id) /* no tracing */ | 66 | #define TIMESTAMP(id) /* no tracing */ |
@@ -75,6 +79,8 @@ feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_ | |||
75 | 79 | ||
76 | #define TIMESTAMP_IRQ(id, irq_count_ptr) /* no tracing */ | 80 | #define TIMESTAMP_IRQ(id, irq_count_ptr) /* no tracing */ |
77 | 81 | ||
82 | #define TIMESTAMP_IN_IRQ(id) /* no tracing */ | ||
83 | |||
78 | #endif | 84 | #endif |
79 | 85 | ||
80 | 86 | ||
@@ -132,7 +138,7 @@ feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_ | |||
132 | #define TS_EXIT_NP_END TIMESTAMP(151) | 138 | #define TS_EXIT_NP_END TIMESTAMP(151) |
133 | 139 | ||
134 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) | 140 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) |
135 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) | 141 | #define TS_SEND_RESCHED_END TIMESTAMP_IN_IRQ(191) |
136 | 142 | ||
137 | #define TS_RELEASE_LATENCY(when) LTIMESTAMP(208, &(when)) | 143 | #define TS_RELEASE_LATENCY(when) LTIMESTAMP(208, &(when)) |
138 | 144 | ||
diff --git a/litmus/trace.c b/litmus/trace.c index 4e3d116fe050..7dbb98e4a3cd 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -58,6 +58,7 @@ static inline void write_timestamp(uint8_t event, | |||
58 | uint16_t pid_fragment, | 58 | uint16_t pid_fragment, |
59 | unsigned int irq_count, | 59 | unsigned int irq_count, |
60 | int record_irq, | 60 | int record_irq, |
61 | int hide_irq, | ||
61 | uint64_t timestamp, | 62 | uint64_t timestamp, |
62 | int record_timestamp) | 63 | int record_timestamp) |
63 | { | 64 | { |
@@ -84,7 +85,7 @@ static inline void write_timestamp(uint8_t event, | |||
84 | if (record_irq) | 85 | if (record_irq) |
85 | irq_count = get_and_clear_irq_fired(); | 86 | irq_count = get_and_clear_irq_fired(); |
86 | 87 | ||
87 | save_irq_flags(ts, irq_count); | 88 | save_irq_flags(ts, irq_count - hide_irq); |
88 | 89 | ||
89 | if (record_timestamp) | 90 | if (record_timestamp) |
90 | timestamp = ft_timestamp(); | 91 | timestamp = ft_timestamp(); |
@@ -122,7 +123,7 @@ feather_callback void save_timestamp(unsigned long event) | |||
122 | write_timestamp(event, TSK_UNKNOWN, | 123 | write_timestamp(event, TSK_UNKNOWN, |
123 | raw_smp_processor_id(), | 124 | raw_smp_processor_id(), |
124 | current->pid, | 125 | current->pid, |
125 | 0, 1, | 126 | 0, 1, 0, |
126 | 0, 1); | 127 | 0, 1); |
127 | } | 128 | } |
128 | 129 | ||
@@ -132,7 +133,7 @@ feather_callback void save_timestamp_def(unsigned long event, | |||
132 | write_timestamp(event, type, | 133 | write_timestamp(event, type, |
133 | raw_smp_processor_id(), | 134 | raw_smp_processor_id(), |
134 | current->pid, | 135 | current->pid, |
135 | 0, 1, | 136 | 0, 1, 0, |
136 | 0, 1); | 137 | 0, 1); |
137 | } | 138 | } |
138 | 139 | ||
@@ -145,7 +146,7 @@ feather_callback void save_timestamp_task(unsigned long event, | |||
145 | write_timestamp(event, rt ? TSK_RT : TSK_BE, | 146 | write_timestamp(event, rt ? TSK_RT : TSK_BE, |
146 | raw_smp_processor_id(), | 147 | raw_smp_processor_id(), |
147 | t->pid, | 148 | t->pid, |
148 | 0, 1, | 149 | 0, 1, 0, |
149 | 0, 1); | 150 | 0, 1); |
150 | } | 151 | } |
151 | 152 | ||
@@ -153,7 +154,8 @@ feather_callback void save_timestamp_cpu(unsigned long event, | |||
153 | unsigned long cpu) | 154 | unsigned long cpu) |
154 | { | 155 | { |
155 | write_timestamp(event, TSK_UNKNOWN, cpu, current->pid, | 156 | write_timestamp(event, TSK_UNKNOWN, cpu, current->pid, |
156 | 0, 1, 0, 1); | 157 | 0, 1, 0, |
158 | 0, 1); | ||
157 | } | 159 | } |
158 | 160 | ||
159 | feather_callback void save_task_latency(unsigned long event, | 161 | feather_callback void save_task_latency(unsigned long event, |
@@ -163,31 +165,41 @@ feather_callback void save_task_latency(unsigned long event, | |||
163 | lt_t *when = (lt_t*) when_ptr; | 165 | lt_t *when = (lt_t*) when_ptr; |
164 | 166 | ||
165 | write_timestamp(event, TSK_RT, raw_smp_processor_id(), 0, | 167 | write_timestamp(event, TSK_RT, raw_smp_processor_id(), 0, |
166 | 0, 1, | 168 | 0, 1, 0, |
167 | now - *when, 0); | 169 | now - *when, 0); |
168 | } | 170 | } |
169 | 171 | ||
170 | /* fake timestamp to user-reported time */ | 172 | /* fake timestamp to user-reported time */ |
171 | void save_timestamp_time(unsigned long event, | 173 | feather_callback void save_timestamp_time(unsigned long event, |
172 | unsigned long ptr) | 174 | unsigned long ptr) |
173 | { | 175 | { |
174 | uint64_t* time = (uint64_t*) ptr; | 176 | uint64_t* time = (uint64_t*) ptr; |
175 | 177 | ||
176 | write_timestamp(event, is_realtime(current) ? TSK_RT : TSK_BE, | 178 | write_timestamp(event, is_realtime(current) ? TSK_RT : TSK_BE, |
177 | raw_smp_processor_id(), current->pid, | 179 | raw_smp_processor_id(), current->pid, |
178 | 0, 1, | 180 | 0, 1, 0, |
179 | *time, 0); | 181 | *time, 0); |
180 | } | 182 | } |
181 | 183 | ||
182 | /* Record user-reported IRQ count */ | 184 | /* Record user-reported IRQ count */ |
183 | void save_timestamp_irq(unsigned long event, | 185 | feather_callback void save_timestamp_irq(unsigned long event, |
184 | unsigned long irq_counter_ptr) | 186 | unsigned long irq_counter_ptr) |
185 | { | 187 | { |
186 | uint64_t* irqs = (uint64_t*) irq_counter_ptr; | 188 | uint64_t* irqs = (uint64_t*) irq_counter_ptr; |
187 | 189 | ||
188 | write_timestamp(event, is_realtime(current) ? TSK_RT : TSK_BE, | 190 | write_timestamp(event, is_realtime(current) ? TSK_RT : TSK_BE, |
189 | raw_smp_processor_id(), current->pid, | 191 | raw_smp_processor_id(), current->pid, |
190 | *irqs, 0, | 192 | *irqs, 0, 0, |
193 | 0, 1); | ||
194 | } | ||
195 | |||
196 | /* Suppress one IRQ from the irq count. Used by TS_SEND_RESCHED_END, which is | ||
197 | * called from within an interrupt that is expected. */ | ||
198 | feather_callback void save_timestamp_hide_irq(unsigned long event) | ||
199 | { | ||
200 | write_timestamp(event, is_realtime(current) ? TSK_RT : TSK_BE, | ||
201 | raw_smp_processor_id(), current->pid, | ||
202 | 0, 1, 1, | ||
191 | 0, 1); | 203 | 0, 1); |
192 | } | 204 | } |
193 | 205 | ||