Re: [PATCH v1] perf record: Add an option to take an AUX snapshot on exit

From: Arnaldo Carvalho de Melo
Date: Tue Aug 13 2019 - 11:33:35 EST


Em Tue, Aug 06, 2019 at 05:41:01PM +0300, Alexander Shishkin escreveu:
> It is sometimes useful to generate a snapshot when perf record exits;
> I've been using a wrapper script around the workload that would do a
> killall -USR2 perf when the workload exits.
>
> @@ -654,7 +670,7 @@ int record__auxtrace_mmap_read(struct record *rec __maybe_unused,
> }
>
> static inline
> -void record__read_auxtrace_snapshot(struct record *rec __maybe_unused)
> +void record__read_auxtrace_snapshot(struct record *rec __maybe_unused, bool on_exit)

You forgot to add the __maybe_unused for the on_exit and later for the
'rec' in record__auxtrace_snapshot_exit, which causes the build to fail
when auxtrace isn't being built, I've fixed those.

- Arnaldo

> {
> }
>
> @@ -664,6 +680,12 @@ int auxtrace_record__snapshot_start(struct auxtrace_record *itr __maybe_unused)
> return 0;
> }
>
> +static inline
> +int record__auxtrace_snapshot_exit(struct record *rec)
> +{
> + return 0;
> +}
> +
> static int record__auxtrace_init(struct record *rec __maybe_unused)
> {
> return 0;
> @@ -1536,7 +1558,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)