Re: [PATCH v2 2/6] perf record: Split output into multiple files via '--switch-output'

From: Arnaldo Carvalho de Melo
Date: Thu Apr 14 2016 - 19:59:57 EST


Em Thu, Apr 14, 2016 at 02:22:01PM +0000, Wang Nan escreveu:
> Allow 'perf record' splits its output into multiple files.
>
> For example:
>
> # ~/perf record -a --timestamp-filename --switch-output &
> [1] 10763
> # kill -s SIGUSR2 10763
> [ perf record: dump data: Woken up 1 times ]
> # [ perf record: Dump perf.data.2015122622314468 ]
>
> # kill -s SIGUSR2 10763
> [ perf record: dump data: Woken up 1 times ]
> # [ perf record: Dump perf.data.2015122622314762 ]
>
> # kill -s SIGUSR2 10763
> [ perf record: dump data: Woken up 1 times ]
> #[ perf record: Dump perf.data.2015122622315171 ]
>
> # fg
> perf record -a --timestamp-filename --switch-output
> ^C[ perf record: Woken up 1 times to write data ]
> [ perf record: Dump perf.data.2015122622315513 ]
> [ perf record: Captured and wrote 0.014 MB perf.data.<timestamp> (296 samples) ]

Added this as an initial man page entry:


diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 19aa17532a16..a77a431ca4ef 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -347,6 +347,14 @@ Configure all used events to run in kernel space.
--all-user::
Configure all used events to run in user space.

+--switch-output::
+Generate multiple perf.data files, timestamp prefixed, switching to a new one
+when receiving a SIGUSR2.
+
+A possible use case is to, given an external event, slice the perf.data file
+that gets then processed, possibly via a perf script, to decide if that
+particular perf.data snapshot should be kept or not.
+
SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-list[1]