diff options
author | Robert Richter <robert.richter@amd.com> | 2008-12-30 04:10:46 +0100 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2009-01-07 22:40:02 +0100 |
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) entry->irq_flags); } -struct op_sample *op_cpu_buffer_read_entry(int cpu) +struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu) { struct ring_buffer_event *e; e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); if (e) - return ring_buffer_event_data(e); + goto event; if (ring_buffer_swap_cpu(op_ring_buffer_read, op_ring_buffer_write, cpu)) return NULL; e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); if (e) - return ring_buffer_event_data(e); + goto event; return NULL; + +event: + entry->event = e; + entry->sample = ring_buffer_event_data(e); + entry->size = (ring_buffer_event_length(e) - sizeof(struct op_sample)) + / sizeof(entry->sample->data[0]); + entry->data = entry->sample->data; + return entry->sample; } unsigned long op_cpu_buffer_entries(int cpu) |