From: Jiri Olsa <jolsa@redhat.com>
To: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Alexander Antonov <alexander.antonov@linux.intel.com>,
Alexei Budankov <abudankov@huawei.com>,
Riccardo Mancini <rickyman7@gmail.com>
Subject: Re: [PATCH v12 08/16] perf record: Introduce data file at mmap buffer object
Date: Sun, 5 Dec 2021 16:14:40 +0100 [thread overview]
Message-ID: <YazXYN9r68M/RH9T@krava> (raw)
In-Reply-To: <06c298ce2f2f05964fb507524e1eb7080d57da4b.1637675515.git.alexey.v.bayduraev@linux.intel.com>
On Tue, Nov 23, 2021 at 05:08:04PM +0300, Alexey Bayduraev wrote:
SNIP
> +static int record__threads_enabled(struct record *rec)
> +{
> + return rec->opts.threads_spec;
> +}
> +
> static bool switch_output_signal(struct record *rec)
> {
> return rec->switch_output.signal &&
> @@ -197,12 +202,16 @@ static int record__write(struct record *rec, struct mmap *map __maybe_unused,
> {
> struct perf_data_file *file = &rec->session->data->file;
>
> + if (map && map->file)
> + file = map->file;
> +
> if (perf_data_file__write(file, bf, size) < 0) {
> pr_err("failed to write perf data, error: %m\n");
> return -1;
> }
>
> - rec->bytes_written += size;
> + if (!(map && map->file))
> + rec->bytes_written += size;
why is this incremented under that condition?
>
> if (record__output_max_size_exceeded(rec) && !done) {
> fprintf(stderr, "[ perf record: perf size limit reached (%" PRIu64 " KB),"
> @@ -1102,7 +1111,7 @@ static int record__alloc_thread_data(struct record *rec, struct evlist *evlist)
> static int record__mmap_evlist(struct record *rec,
> struct evlist *evlist)
> {
SNIP
> @@ -1574,6 +1601,7 @@ static void record__init_features(struct record *rec)
> static void
> record__finish_output(struct record *rec)
> {
> + int i;
> struct perf_data *data = &rec->data;
> int fd = perf_data__fd(data);
>
> @@ -1582,8 +1610,14 @@ record__finish_output(struct record *rec)
>
> rec->session->header.data_size += rec->bytes_written;
> data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR);
> + if (record__threads_enabled(rec)) {
> + for (i = 0; i < data->dir.nr; i++)
> + data->dir.files[i].size = lseek(data->dir.files[i].fd, 0, SEEK_CUR);
> + }
>
> if (!rec->no_buildid) {
> + /* this will be recalculated during process_buildids() */
> + rec->samples = 0;
> process_buildids(rec);
>
> if (rec->buildid_all)
> @@ -2490,8 +2524,6 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
> status = err;
>
> record__synthesize(rec, true);
> - /* this will be recalculated during process_buildids() */
> - rec->samples = 0;
hm, why is this removed?
jirka
>
> if (!err) {
> if (!rec->timestamp_filename) {
> @@ -3312,7 +3344,7 @@ int cmd_record(int argc, const char **argv)
> goto out_opts;
> }
>
> - if (rec->opts.kcore)
> + if (rec->opts.kcore || record__threads_enabled(rec))
> rec->data.is_dir = true;
>
> if (rec->opts.comp_level != 0) {
> diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h
> index 8e259b9610f8..a3370a8bf307 100644
> --- a/tools/perf/util/mmap.h
> +++ b/tools/perf/util/mmap.h
> @@ -44,6 +44,7 @@ struct mmap {
> struct mmap_cpu_mask affinity_mask;
> void *data;
> int comp_level;
> + struct perf_data_file *file;
> };
>
> struct mmap_params {
> diff --git a/tools/perf/util/record.h b/tools/perf/util/record.h
> index ef6c2715fdd9..ad08c092f3dd 100644
> --- a/tools/perf/util/record.h
> +++ b/tools/perf/util/record.h
> @@ -78,6 +78,7 @@ struct record_opts {
> int ctl_fd_ack;
> bool ctl_fd_close;
> int synth;
> + int threads_spec;
> };
>
> extern const char * const *record_usage;
> --
> 2.19.0
>
next prev parent reply other threads:[~2021-12-05 15:14 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 14:07 [PATCH v12 00/16] Introduce threaded trace streaming for basic perf record operation Alexey Bayduraev
2021-11-23 14:07 ` [PATCH v12 01/16] perf record: Introduce thread affinity and mmap masks Alexey Bayduraev
2021-12-05 15:13 ` Jiri Olsa
2021-12-20 10:37 ` Bayduraev, Alexey V
2021-11-23 14:07 ` [PATCH v12 02/16] tools lib: Introduce fdarray duplicate function Alexey Bayduraev
2021-11-23 14:07 ` [PATCH v12 03/16] perf record: Introduce thread specific data array Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 04/16] perf record: Introduce function to propagate control commands Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 05/16] perf record: Introduce thread local variable Alexey Bayduraev
2021-12-05 15:14 ` Jiri Olsa
2021-12-20 9:49 ` Bayduraev, Alexey V
2021-11-23 14:08 ` [PATCH v12 06/16] perf record: Stop threads in the end of trace streaming Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 07/16] perf record: Start threads in the beginning " Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 08/16] perf record: Introduce data file at mmap buffer object Alexey Bayduraev
2021-12-05 15:14 ` Jiri Olsa [this message]
2021-11-23 14:08 ` [PATCH v12 09/16] perf record: Introduce bytes written stats Alexey Bayduraev
2021-12-05 15:14 ` Jiri Olsa
2021-12-06 11:22 ` Bayduraev, Alexey V
2021-11-23 14:08 ` [PATCH v12 10/16] perf record: Introduce compressor at mmap buffer object Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 11/16] perf record: Introduce data transferred and compressed stats Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 12/16] perf record: Introduce --threads command line option Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 13/16] perf record: Extend " Alexey Bayduraev
2021-12-05 15:13 ` Jiri Olsa
2021-12-05 15:14 ` Jiri Olsa
2021-12-05 15:14 ` Jiri Olsa
2021-12-05 15:14 ` Jiri Olsa
2021-11-23 14:08 ` [PATCH v12 14/16] perf record: Implement compatibility checks Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 15/16] perf session: Load data directory files for analysis Alexey Bayduraev
2021-11-23 14:08 ` [PATCH v12 16/16] perf report: Output data file name in raw trace dump Alexey Bayduraev
2021-12-05 15:15 ` [PATCH v12 00/16] Introduce threaded trace streaming for basic perf record operation Jiri Olsa
2021-12-09 17:56 ` Jiri Olsa
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=YazXYN9r68M/RH9T@krava \
--to=jolsa@redhat.com \
--cc=abudankov@huawei.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.antonov@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexey.v.bayduraev@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rickyman7@gmail.com \
/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