aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/cpu_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/cpu_buffer.c')
-rw-r--r--drivers/oprofile/cpu_buffer.c14
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
185struct op_sample *op_cpu_buffer_read_entry(int cpu) 185struct 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
200event:
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
201unsigned long op_cpu_buffer_entries(int cpu) 209unsigned long op_cpu_buffer_entries(int cpu)