Re: [PATCH v2 4/4] perf report: support record trace file decompression
From: Alexey Budankov
Date: Wed Feb 20 2019 - 09:44:35 EST
On 12.02.2019 16:09, Jiri Olsa wrote:
> On Mon, Feb 11, 2019 at 11:25:00PM +0300, Alexey Budankov wrote:
>
> SNIP
>
>> @@ -1932,6 +2059,38 @@ fetch_mmaped_event(struct perf_session *session,
>> return event;
>> }
>>
>> +static int __perf_session__process_decomp_events(struct perf_session *session)
>> +{
>> + s64 skip;
>> + u64 size, file_pos = 0;
>> + union perf_event *event;
>> + struct decomp *decomp = session->decomp_last;
>> +
>> + if (!decomp)
>> + return 0;
>> +
>> + while (decomp->head < decomp->size && !session_done()) {
>
> so how this actualy works? does one PERF_RECORD_COMPRESSED event carry
> complete data to unpack? or you wait to receive more PERF_RECORD_COMPRESSED
> to give you data you can unpack?
One record contains compressed data chunk that is ready for decompression.
Record header is skipped and the rest is fetched to perf_session__zstd_decompress()
also providing the buffer to decompress to, which is of the size encoded in
the file header (comp_mmap_len). After decompression the buffer is iterated
the same way as mmapped event records. Decompressed split event records are
handled. Decompressed buffers are chained into the linked list so the records
memory remains available for later references.
Thanks,
Alexey
>
> jirka
>