Re: [PATCH v5 07/10] perf record: implement -z,--compression_level=n option and compression

Jiri Olsa
2019-03-05T12:26:27Z

On Fri, Mar 01, 2019 at 06:58:32PM +0300, Alexey Budankov wrote:

SNIP

> +static size_t record__process_comp_header(void *record, size_t increment)
> +{
> + struct compressed_event *event = record;
> + size_t size = sizeof(struct compressed_event);
> +
> + if (increment) {
> + event->header.size += increment;
> + return increment;
> + } else {
> + event->header.type = PERF_RECORD_COMPRESSED;
> + event->header.size = size;
> + return size;
> + }

so zstd_compress_stream_to_records calls this in the loop:

while (input.pos < input.size) {
...
size = process_header(record, 0);
...
size = process_header(record, size);
}

the header.size will get overwritten with every new iteration, no?

jirka