4646#include <asm/bug.h>
4747#include <linux/time64.h>
4848
49+ struct switch_output {
50+ bool signal ;
51+ };
52+
4953struct record {
5054 struct perf_tool tool ;
5155 struct record_opts opts ;
@@ -62,7 +66,7 @@ struct record {
6266 bool no_buildid_cache_set ;
6367 bool buildid_all ;
6468 bool timestamp_filename ;
65- bool switch_output ;
69+ struct switch_output switch_output ;
6670 unsigned long long samples ;
6771};
6872
@@ -842,11 +846,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
842846 signal (SIGTERM , sig_handler );
843847 signal (SIGSEGV , sigsegv_handler );
844848
845- if (rec -> opts .auxtrace_snapshot_mode || rec -> switch_output ) {
849+ if (rec -> opts .auxtrace_snapshot_mode || rec -> switch_output . signal ) {
846850 signal (SIGUSR2 , snapshot_sig_handler );
847851 if (rec -> opts .auxtrace_snapshot_mode )
848852 trigger_on (& auxtrace_snapshot_trigger );
849- if (rec -> switch_output )
853+ if (rec -> switch_output . signal )
850854 trigger_on (& switch_output_trigger );
851855 } else {
852856 signal (SIGUSR2 , SIG_IGN );
@@ -1519,7 +1523,7 @@ static struct option __record_options[] = {
15191523 "Record build-id of all DSOs regardless of hits" ),
15201524 OPT_BOOLEAN (0 , "timestamp-filename" , & record .timestamp_filename ,
15211525 "append timestamp to output filename" ),
1522- OPT_BOOLEAN (0 , "switch-output" , & record .switch_output ,
1526+ OPT_BOOLEAN (0 , "switch-output" , & record .switch_output . signal ,
15231527 "Switch output when receive SIGUSR2" ),
15241528 OPT_BOOLEAN (0 , "dry-run" , & dry_run ,
15251529 "Parse options then exit" ),
@@ -1578,7 +1582,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
15781582 return - EINVAL ;
15791583 }
15801584
1581- if (rec -> switch_output )
1585+ if (rec -> switch_output . signal )
15821586 rec -> timestamp_filename = true;
15831587
15841588 if (!rec -> itr ) {
@@ -1629,7 +1633,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
16291633
16301634 if (rec -> no_buildid_cache || rec -> no_buildid ) {
16311635 disable_buildid_cache ();
1632- } else if (rec -> switch_output ) {
1636+ } else if (rec -> switch_output . signal ) {
16331637 /*
16341638 * In 'perf record --switch-output', disable buildid
16351639 * generation by default to reduce data file switching
0 commit comments