Re: [PATCH v7 06/12] perf util: introduce Zstd based streaming compression API

From: Alexey Budankov
Date: Wed Mar 13 2019 - 11:06:30 EST



On 13.03.2019 17:37, Jiri Olsa wrote:
> On Tue, Mar 12, 2019 at 08:23:42AM +0300, Alexey Budankov wrote:
>>
>> Implemented functions are based on Zstd streaming compression API.
>> The functions are used in runtime to compress data that come from
>> mmaped kernel buffer. zstd_init(), zstd_fini() are used for
>> initialization and finalization to allocate and deallocate internal
>> zstd objects. zstd_compress_stream_to_records() is used to convert
>> parts of mmaped kernel buffer into an array of PERF_RECORD_COMPRESSED
>> records.
>>
>> Signed-off-by: Alexey Budankov <alexey.budankov@xxxxxxxxxxxxxxx>
>> ---
>> tools/perf/util/Build | 2 +
>> tools/perf/util/compress.h | 18 ++++++++
>> tools/perf/util/zstd.c | 95 ++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 115 insertions(+)
>> create mode 100644 tools/perf/util/zstd.c
>>
>> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
>> index 8dd3102301ea..920ee8bebd83 100644
>> --- a/tools/perf/util/Build
>> +++ b/tools/perf/util/Build
>> @@ -145,6 +145,8 @@ perf-y += scripting-engines/
>>
>> perf-$(CONFIG_ZLIB) += zlib.o
>> perf-$(CONFIG_LZMA) += lzma.o
>> +perf-y += zstd.o
>
> we have CONFIG_ZSTD, so we can do:
>
> perf-$(CONFIG_ZSTD) += zstd.o
>
> and skip that #ifdef HAVE_ZSTD_SUPPORT in zstd.c
> and put stub inlines into compress.h

in v8.

~Alexey

>
> thanks,
> jirka
>