From: Jiwei Sun <Jiwei.Sun@windriver.com>
To: Jiri Olsa <jolsa@redhat.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: Tue, 22 Oct 2019 13:56:30 +0800 [thread overview]
Message-ID: <97a91775-c34c-ede4-4049-ce47160f4773@windriver.com> (raw)
In-Reply-To: <20191021134137.GA8264@krava>
Hi Jirka,
On 2019e9410f\x1c\b21f\x17% 21:41, Jiri Olsa wrote:
> 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 for your suggestions. Yes, if just set "done == 1" is more efficient and more concise.
And I will modify it and the output format, and then send a v5 patch.
Thanks again.
Regards,
Jiwei
>
> thanks,
> jirka
>
>
next prev parent reply other threads:[~2019-10-22 5:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 7:06 Jiwei Sun
2019-10-21 11:51 ` Jiwei Sun
2019-10-21 11:55 ` Jiri Olsa
2019-10-21 13:41 ` Jiri Olsa
2019-10-22 5:56 ` Jiwei Sun [this message]
-- 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=97a91775-c34c-ede4-4049-ce47160f4773@windriver.com \
--to=jiwei.sun@windriver.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=jolsa@redhat.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
all inboxes | Powered by JetHome®