Re: [PATCH v2 4/4] perf report: support record trace file decompression

From: Alexey Budankov
Date: Wed Feb 20 2019 - 10:19:09 EST



On 12.02.2019 16:08, Jiri Olsa wrote:
> On Mon, Feb 11, 2019 at 11:25:00PM +0300, Alexey Budankov wrote:
>
> SNIP
>
>> size_t perf_session__zstd_copy(void *to __maybe_unused,
>> @@ -533,6 +646,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
>> tool->time_conv = process_event_op2_stub;
>> if (tool->feature == NULL)
>> tool->feature = process_event_op2_stub;
>> + if (tool->compressed == NULL)
>> + tool->compressed = perf_session__process_compressed_event;
>> }
>>
>> static void swap_sample_id_all(union perf_event *event, void *data)
>> @@ -1469,7 +1584,8 @@ static s64 perf_session__process_user_event(struct perf_session *session,
>> int fd = perf_data__fd(session->data);
>> int err;
>>
>> - dump_event(session->evlist, event, file_offset, &sample);
>> + if (event->header.type != PERF_RECORD_COMPRESSED)
>> + dump_event(session->evlist, event, file_offset, &sample);
>>
>> /* These events are processed right away */
>> switch (event->header.type) {
>> @@ -1522,6 +1638,11 @@ static s64 perf_session__process_user_event(struct perf_session *session,
>> return tool->time_conv(session, event);
>> case PERF_RECORD_HEADER_FEATURE:
>> return tool->feature(session, event);
>> + case PERF_RECORD_COMPRESSED:
>> + err = tool->compressed(session, event, file_offset);
>> + if (err)
>> + dump_event(session->evlist, event, file_offset, &sample);
>
> I'm not sure about having compressed callback at all, but maybe
> it could be usefull for inject, to get the compressed data..?

This code implements handling thru callbacks, for some reason,
so the new part is designed the same way. Inject flow probably
will benefit from this approach. It is required to be tested
additionally.

Thanks,
Alexey


>
> I assume inject is working now and it will get you the uncompressed
> perf.data?
>
> jirka
>