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

From: Jiri Olsa
Date: Wed Mar 13 2019 - 10:37:15 EST


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

thanks,
jirka