trace-cmd library: Use uncompressed size for file size
PATCH 1/1 trace-cmd library: Use uncompressed size for file size
From: "Steven Rostedt (Google)" <[email protected]>
For tracecmd_read_at() to work, each offset for every record in the file needs to be unique. To do so, each CPU's file_offset is from the last CPU's file_offset plus its size. But the size used was the compressed size and not the uncompressed size.
This had "interesting" effects, where some lookups were failing. It also caused tracecmd_read_cpu_last() to not return the last event.
Fixes add83e0c8b511 ("trace-cmd library: Fix tracecmd_read_at()")
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- lib/trace-cmd/trace-input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/trace-cmd/trace-input.c +2 -1
@@ -2699,13 +2699,14 @@ static int init_cpu_zpage(struct tracecmd_input *handle, int cpu) cpu_data->compress.last_chunk =0 ; cpu_data->file_offset = handle->next_offset; + cpu_data->file_size =0 ;for (i =0 ; i < count; i++) cpu_data->file_size += cpu_data->compress.chunks[i].size; cpu_data->offset = cpu_data->file_offset; cpu_data->size = cpu_data->file_size; - handle->next_offset = (handle->next_offset + cpu_data->size + handle->page_size -1 ) & + handle->next_offset = (handle->next_offset + cpu_data->file_size + handle->page_size -1 ) & ~(handle->page_size -1 );return 0 ; }
Signature · 1 line
2.35.1