diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-01-09 04:51:56 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-01-11 14:48:01 -0500 |
commit | 1b43b70484a9617de5fe2c12e64bea006010ac1c (patch) | |
tree | 573daf43a9d798f7563f7fb74cedb813d1cc28fc | |
parent | 9808143ba2e54818a3cf445d9b69b3f5f15451ee (diff) |
perf record: Add struct switch_output
Next patches will add more --switch-output option arguments,
so preparing the data holder.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1483955520-29063-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-record.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 4ec10e9427d9..f7e805b30527 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -46,6 +46,10 @@ | |||
46 | #include <asm/bug.h> | 46 | #include <asm/bug.h> |
47 | #include <linux/time64.h> | 47 | #include <linux/time64.h> |
48 | 48 | ||
49 | struct switch_output { | ||
50 | bool signal; | ||
51 | }; | ||
52 | |||
49 | struct record { | 53 | struct record { |
50 | struct perf_tool tool; | 54 | struct perf_tool tool; |
51 | struct record_opts opts; | 55 | struct record_opts opts; |
@@ -62,7 +66,7 @@ struct record { | |||
62 | bool no_buildid_cache_set; | 66 | bool no_buildid_cache_set; |
63 | bool buildid_all; | 67 | bool buildid_all; |
64 | bool timestamp_filename; | 68 | bool timestamp_filename; |
65 | bool switch_output; | 69 | struct switch_output switch_output; |
66 | unsigned long long samples; | 70 | unsigned long long samples; |
67 | }; | 71 | }; |
68 | 72 | ||
@@ -842,11 +846,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
842 | signal(SIGTERM, sig_handler); | 846 | signal(SIGTERM, sig_handler); |
843 | signal(SIGSEGV, sigsegv_handler); | 847 | signal(SIGSEGV, sigsegv_handler); |
844 | 848 | ||
845 | if (rec->opts.auxtrace_snapshot_mode || rec->switch_output) { | 849 | if (rec->opts.auxtrace_snapshot_mode || rec->switch_output.signal) { |
846 | signal(SIGUSR2, snapshot_sig_handler); | 850 | signal(SIGUSR2, snapshot_sig_handler); |
847 | if (rec->opts.auxtrace_snapshot_mode) | 851 | if (rec->opts.auxtrace_snapshot_mode) |
848 | trigger_on(&auxtrace_snapshot_trigger); | 852 | trigger_on(&auxtrace_snapshot_trigger); |
849 | if (rec->switch_output) | 853 | if (rec->switch_output.signal) |
850 | trigger_on(&switch_output_trigger); | 854 | trigger_on(&switch_output_trigger); |
851 | } else { | 855 | } else { |
852 | signal(SIGUSR2, SIG_IGN); | 856 | signal(SIGUSR2, SIG_IGN); |
@@ -1519,7 +1523,7 @@ static struct option __record_options[] = { | |||
1519 | "Record build-id of all DSOs regardless of hits"), | 1523 | "Record build-id of all DSOs regardless of hits"), |
1520 | OPT_BOOLEAN(0, "timestamp-filename", &record.timestamp_filename, | 1524 | OPT_BOOLEAN(0, "timestamp-filename", &record.timestamp_filename, |
1521 | "append timestamp to output filename"), | 1525 | "append timestamp to output filename"), |
1522 | OPT_BOOLEAN(0, "switch-output", &record.switch_output, | 1526 | OPT_BOOLEAN(0, "switch-output", &record.switch_output.signal, |
1523 | "Switch output when receive SIGUSR2"), | 1527 | "Switch output when receive SIGUSR2"), |
1524 | OPT_BOOLEAN(0, "dry-run", &dry_run, | 1528 | OPT_BOOLEAN(0, "dry-run", &dry_run, |
1525 | "Parse options then exit"), | 1529 | "Parse options then exit"), |
@@ -1578,7 +1582,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1578 | return -EINVAL; | 1582 | return -EINVAL; |
1579 | } | 1583 | } |
1580 | 1584 | ||
1581 | if (rec->switch_output) | 1585 | if (rec->switch_output.signal) |
1582 | rec->timestamp_filename = true; | 1586 | rec->timestamp_filename = true; |
1583 | 1587 | ||
1584 | if (!rec->itr) { | 1588 | if (!rec->itr) { |
@@ -1629,7 +1633,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1629 | 1633 | ||
1630 | if (rec->no_buildid_cache || rec->no_buildid) { | 1634 | if (rec->no_buildid_cache || rec->no_buildid) { |
1631 | disable_buildid_cache(); | 1635 | disable_buildid_cache(); |
1632 | } else if (rec->switch_output) { | 1636 | } else if (rec->switch_output.signal) { |
1633 | /* | 1637 | /* |
1634 | * In 'perf record --switch-output', disable buildid | 1638 | * In 'perf record --switch-output', disable buildid |
1635 | * generation by default to reduce data file switching | 1639 | * generation by default to reduce data file switching |