diff options
author | Robert Richter <robert.richter@amd.com> | 2008-12-29 22:10:46 -0500 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2009-01-07 16:40:02 -0500 |
commit | 2d87b14cf8d0b07720de26d90789d02124141616 (patch) | |
tree | 418285e8cd7127c6207ac9a3e1acf8f0f3c2282f /drivers/oprofile/cpu_buffer.c | |
parent | 2cc28b9f261dd28d69767a34682ce55a27d928ed (diff) |
oprofile: modify op_cpu_buffer_read_entry()
This implements the support of samples with attached data.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile/cpu_buffer.c')
-rw-r--r-- | drivers/oprofile/cpu_buffer.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c index 934ff159e70e..400f7fcffdbe 100644 --- a/drivers/oprofile/cpu_buffer.c +++ b/drivers/oprofile/cpu_buffer.c | |||
@@ -182,20 +182,28 @@ int op_cpu_buffer_write_commit(struct op_entry *entry) | |||
182 | entry->irq_flags); | 182 | entry->irq_flags); |
183 | } | 183 | } |
184 | 184 | ||
185 | struct op_sample *op_cpu_buffer_read_entry(int cpu) | 185 | struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu) |
186 | { | 186 | { |
187 | struct ring_buffer_event *e; | 187 | struct ring_buffer_event *e; |
188 | e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); | 188 | e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); |
189 | if (e) | 189 | if (e) |
190 | return ring_buffer_event_data(e); | 190 | goto event; |
191 | if (ring_buffer_swap_cpu(op_ring_buffer_read, | 191 | if (ring_buffer_swap_cpu(op_ring_buffer_read, |
192 | op_ring_buffer_write, | 192 | op_ring_buffer_write, |
193 | cpu)) | 193 | cpu)) |
194 | return NULL; | 194 | return NULL; |
195 | e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); | 195 | e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); |
196 | if (e) | 196 | if (e) |
197 | return ring_buffer_event_data(e); | 197 | goto event; |
198 | return NULL; | 198 | return NULL; |
199 | |||
200 | event: | ||
201 | entry->event = e; | ||
202 | entry->sample = ring_buffer_event_data(e); | ||
203 | entry->size = (ring_buffer_event_length(e) - sizeof(struct op_sample)) | ||
204 | / sizeof(entry->sample->data[0]); | ||
205 | entry->data = entry->sample->data; | ||
206 | return entry->sample; | ||
199 | } | 207 | } |
200 | 208 | ||
201 | unsigned long op_cpu_buffer_entries(int cpu) | 209 | unsigned long op_cpu_buffer_entries(int cpu) |