From: Jiri Olsa <jolsa@redhat.com>
To: Jiwei Sun <jiwei.sun@windriver.com>
Cc: acme@redhat.com, arnaldo.melo@gmail.com,
linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com,
mpetlan@redhat.com, namhyung@kernel.org, a.p.zijlstra@chello.nl,
adrian.hunter@intel.com, Richard.Danter@windriver.com
Subject: Re: [PATCH v4] perf record: Add support for limit perf output file size
Date: Mon, 21 Oct 2019 15:41:37 +0200 [thread overview]
Message-ID: <20191021134137.GA8264@krava> (raw)
In-Reply-To: <20190925070637.13164-1-jiwei.sun@windriver.com>
On Wed, Sep 25, 2019 at 03:06:37PM +0800, Jiwei Sun wrote:
SNIP
> SEE ALSO
> --------
> linkperf:perf-stat[1], linkperf:perf-list[1]
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 48600c90cc7e..30904d2a3407 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -91,6 +91,7 @@ struct record {
> struct switch_output switch_output;
> unsigned long long samples;
> cpu_set_t affinity_mask;
> + unsigned long output_max_size; /* = 0: unlimited */
> };
>
> static volatile int auxtrace_record__snapshot_started;
> @@ -120,6 +121,12 @@ static bool switch_output_time(struct record *rec)
> trigger_is_ready(&switch_output_trigger);
> }
>
> +static bool record__output_max_size_exceeded(struct record *rec)
> +{
> + return rec->output_max_size &&
> + (rec->bytes_written >= rec->output_max_size);
> +}
> +
> static int record__write(struct record *rec, struct mmap *map __maybe_unused,
> void *bf, size_t size)
> {
> @@ -132,6 +139,12 @@ static int record__write(struct record *rec, struct mmap *map __maybe_unused,
>
> rec->bytes_written += size;
>
> + if (record__output_max_size_exceeded(rec)) {
> + WARN_ONCE(1, "WARNING: The perf data has already reached "
> + "the limit, stop recording!\n");
I think the message whouldn't be a warning, the user asked for
that, maybe something more like:
[ perf record: perf size limit reached (XXMB), stopping session ]
> + raise(SIGTERM);
could we just set 'done = 1' what's the benefit in killing perf?
thanks,
jirka
next prev parent reply other threads:[~2019-10-21 13:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 7:06 [PATCH v4] perf record: Add support for limit perf output file size Jiwei Sun
2019-10-21 11:51 ` Jiwei Sun
2019-10-21 11:55 ` Jiri Olsa
2019-10-21 13:41 ` Jiri Olsa [this message]
2019-10-22 5:56 ` Jiwei Sun
-- strict thread matches above, loose matches on Subject: below --
2019-07-17 8:19 Jiwei Sun
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=20191021134137.GA8264@krava \
--to=jolsa@redhat.com \
--cc=Richard.Danter@windriver.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=arnaldo.melo@gmail.com \
--cc=jiwei.sun@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpetlan@redhat.com \
--cc=namhyung@kernel.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