From: Alexey Budankov <alexey.budankov@linux.intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Andi Kleen <ak@linux.intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH v10 09/12] perf record: implement -z,--compression_level[=<n>] option
Date: Mon, 18 Mar 2019 20:44:42 +0300 [thread overview]
Message-ID: <9ff06518-ae63-a908-e44d-5d9e56dd66d9@linux.intel.com> (raw)
In-Reply-To: <12cce142-6238-475b-b9aa-236531c12c2b@linux.intel.com>
Implemented -z,--compression_level[=<n>] option that enables compression
of mmaped kernel data buffers content in runtime during perf record
mode collection. Default option value is 1 (fastest compression).
Compression overhead has been measured for serial and AIO streaming
when profiling matrix multiplication workload:
-------------------------------------------------------------
| SERIAL | AIO-1 |
----------------------------------------------------------------|
|-z | OVH(x) | ratio(x) size(MiB) | OVH(x) | ratio(x) size(MiB) |
|---------------------------------------------------------------|
| 0 | 1,00 | 1,000 179,424 | 1,00 | 1,000 187,527 |
| 1 | 1,04 | 8,427 181,148 | 1,01 | 8,474 188,562 |
| 2 | 1,07 | 8,055 186,953 | 1,03 | 7,912 191,773 |
| 3 | 1,04 | 8,283 181,908 | 1,03 | 8,220 191,078 |
| 5 | 1,09 | 8,101 187,705 | 1,05 | 7,780 190,065 |
| 8 | 1,05 | 9,217 179,191 | 1,12 | 6,111 193,024 |
-----------------------------------------------------------------
OVH = (Execution time with -z N) / (Execution time with -z 0)
ratio - compression ratio
size - number of bytes that was compressed
size ~= trace size x ratio
Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
---
tools/perf/Documentation/perf-record.txt | 5 +++++
tools/perf/builtin-record.c | 25 ++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 18fceb49434e..0567bacc2ae6 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -471,6 +471,11 @@ Also at some cases executing less trace write syscalls with bigger data size can
shorter than executing more trace write syscalls with smaller data size thus lowering
runtime profiling overhead.
+-z::
+--compression-level[=n]::
+Produce compressed trace using specified level n (default: 1 - fastest compression,
+22 - smallest trace)
+
--all-kernel::
Configure all used events to run in kernel space.
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 2e083891affa..7258f2964a3b 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -440,6 +440,26 @@ static int record__mmap_flush_parse(const struct option *opt,
return 0;
}
+#ifdef HAVE_ZSTD_SUPPORT
+static unsigned int comp_level_default = 1;
+static int record__parse_comp_level(const struct option *opt,
+ const char *str,
+ int unset)
+{
+ struct record_opts *opts = (struct record_opts *)opt->value;
+
+ if (unset) {
+ opts->comp_level = 0;
+ } else {
+ if (str)
+ opts->comp_level = strtol(str, NULL, 0);
+ if (!opts->comp_level)
+ opts->comp_level = comp_level_default;
+ }
+
+ return 0;
+}
+#endif
static unsigned int comp_level_max = 22;
static int record__comp_enabled(struct record *rec)
@@ -2169,6 +2189,11 @@ static struct option __record_options[] = {
OPT_CALLBACK(0, "affinity", &record.opts, "node|cpu",
"Set affinity mask of trace reading thread to NUMA node cpu mask or cpu of processed mmap buffer",
record__parse_affinity),
+#ifdef HAVE_ZSTD_SUPPORT
+ OPT_CALLBACK_OPTARG('z', "compression-level", &record.opts, &comp_level_default,
+ "n", "Produce compressed trace using specified level (default: 1 - fastest compression, 22 - smallest trace)",
+ record__parse_comp_level),
+#endif
OPT_END()
};
--
2.20.1
next prev parent reply other threads:[~2019-03-18 17:44 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 17:36 [PATCH v10 00/12] perf: enable compression of record mode trace to save storage space Alexey Budankov
2019-03-18 17:39 ` [PATCH v10 01/12] feature: implement libzstd check, LIBZSTD_DIR and NO_LIBZSTD defines Alexey Budankov
2019-04-05 11:51 ` [tip:perf/core] tools build: Implement libzstd feature " tip-bot for Alexey Budankov
2019-03-18 17:40 ` [PATCH v10 02/12] perf record: implement --mmap-flush=<number> option Alexey Budankov
2019-03-29 19:02 ` Arnaldo Carvalho de Melo
2019-04-01 7:58 ` Alexey Budankov
2019-04-05 11:52 ` [tip:perf/core] perf record: Implement " tip-bot for Alexey Budankov
2019-03-18 17:41 ` [PATCH v10 03/12] perf session: define bytes_transferred and bytes_compressed metrics Alexey Budankov
2019-05-18 9:19 ` [tip:perf/core] perf session: Define 'bytes_transferred' and 'bytes_compressed' metrics tip-bot for Alexey Budankov
2019-03-18 17:41 ` [PATCH v10 04/12] perf record: implement COMPRESSED event record and its attributes Alexey Budankov
2019-05-18 9:20 ` [tip:perf/core] perf record: Implement " tip-bot for Alexey Budankov
2019-03-18 17:42 ` [PATCH v10 05/12] perf mmap: implement dedicated memory buffer for data compression Alexey Budankov
2019-05-18 9:21 ` [tip:perf/core] perf mmap: Implement " tip-bot for Alexey Budankov
2019-03-18 17:42 ` [PATCH v10 06/12] perf util: introduce Zstd streaming based compression API Alexey Budankov
2019-05-18 9:21 ` [tip:perf/core] perf tools: Introduce " tip-bot for Alexey Budankov
2019-03-18 17:43 ` [PATCH v10 07/12] perf record: implement compression for serial trace streaming Alexey Budankov
2019-05-18 9:22 ` [tip:perf/core] perf record: Implement " tip-bot for Alexey Budankov
2019-03-18 17:44 ` [PATCH v10 08/12] perf record: implement compression for AIO " Alexey Budankov
2019-05-18 9:23 ` [tip:perf/core] perf record: Implement " tip-bot for Alexey Budankov
2019-03-18 17:44 ` Alexey Budankov [this message]
2019-05-14 20:04 ` [PATCH v10 09/12] perf record: implement -z,--compression_level[=<n>] option Arnaldo Carvalho de Melo
2019-05-15 5:46 ` Alexey Budankov
2019-05-14 20:20 ` Arnaldo Carvalho de Melo
2019-05-14 21:46 ` Arnaldo Carvalho de Melo
2019-05-15 8:43 ` Alexey Budankov
2019-05-18 9:24 ` [tip:perf/core] perf record: Implement " tip-bot for Alexey Budankov
2019-03-18 17:45 ` [PATCH v10 10/12] perf report: implement record trace decompression Alexey Budankov
2019-05-18 9:23 ` [tip:perf/core] perf report: Add stub processing of compressed events for -D tip-bot for Alexey Budankov
2019-05-18 9:25 ` [tip:perf/core] perf report: Implement perf.data record decompression tip-bot for Alexey Budankov
2019-03-18 17:45 ` [PATCH v10 11/12] perf inject: enable COMPRESSED records decompression Alexey Budankov
2019-05-18 9:25 ` [tip:perf/core] perf inject: Enable COMPRESSED record decompression tip-bot for Alexey Budankov
2019-03-18 17:46 ` [PATCH v10 12/12] perf tests: implement Zstd comp/decomp integration test Alexey Budankov
2019-05-18 9:26 ` [tip:perf/core] perf tests: Implement " tip-bot for Alexey Budankov
2019-03-28 9:28 ` [PATCH v10 00/12] perf: enable compression of record mode trace to save storage space Alexey Budankov
2019-05-15 12:59 [PATCH v10 09/12] perf record: implement -z,--compression_level[=<n>] option Arnaldo Carvalho de Melo
2019-05-15 15:44 ` Alexey Budankov
2019-05-17 15:01 ` Arnaldo Carvalho de Melo
2019-05-17 16:56 ` Alexey Budankov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ff06518-ae63-a908-e44d-5d9e56dd66d9@linux.intel.com \
--to=alexey.budankov@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).