mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
oprofile: fix cpu buffer size
The unit of oprofile_cpu_buffer_size is in samples, but was allocated in bytes. This led to the allocation of too small cpu buffers. This patch recalculates the buffer size in bytes taking also the ring_buffer_event header size into account. Reported-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
parent
091438dd56
commit
54f2c841fa
1 changed files with 6 additions and 2 deletions
|
@ -78,16 +78,20 @@ void free_cpu_buffers(void)
|
|||
op_ring_buffer_write = NULL;
|
||||
}
|
||||
|
||||
#define RB_EVENT_HDR_SIZE 4
|
||||
|
||||
int alloc_cpu_buffers(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
unsigned long buffer_size = oprofile_cpu_buffer_size;
|
||||
unsigned long byte_size = buffer_size * (sizeof(struct op_sample) +
|
||||
RB_EVENT_HDR_SIZE);
|
||||
|
||||
op_ring_buffer_read = ring_buffer_alloc(buffer_size, OP_BUFFER_FLAGS);
|
||||
op_ring_buffer_read = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS);
|
||||
if (!op_ring_buffer_read)
|
||||
goto fail;
|
||||
op_ring_buffer_write = ring_buffer_alloc(buffer_size, OP_BUFFER_FLAGS);
|
||||
op_ring_buffer_write = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS);
|
||||
if (!op_ring_buffer_write)
|
||||
goto fail;
|
||||
|
||||
|
|
Loading…
Reference in a new issue