From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258AbdALIc3 (ORCPT ); Thu, 12 Jan 2017 03:32:29 -0500 Received: from terminus.zytor.com ([198.137.202.10]:35028 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750892AbdALIc1 (ORCPT ); Thu, 12 Jan 2017 03:32:27 -0500 Date: Thu, 12 Jan 2017 00:32:02 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: hpa@zytor.com, namhyung@kernel.org, acme@redhat.com, a.p.zijlstra@chello.nl, jolsa@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, wangnan0@huawei.com, mingo@kernel.org, dsahern@gmail.com Reply-To: linux-kernel@vger.kernel.org, dsahern@gmail.com, mingo@kernel.org, wangnan0@huawei.com, a.p.zijlstra@chello.nl, jolsa@kernel.org, acme@redhat.com, hpa@zytor.com, namhyung@kernel.org, tglx@linutronix.de In-Reply-To: <1483955520-29063-3-git-send-email-jolsa@kernel.org> References: <1483955520-29063-3-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf record: Add struct switch_output Git-Commit-ID: 1b43b70484a9617de5fe2c12e64bea006010ac1c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1b43b70484a9617de5fe2c12e64bea006010ac1c Gitweb: http://git.kernel.org/tip/1b43b70484a9617de5fe2c12e64bea006010ac1c Author: Jiri Olsa AuthorDate: Mon, 9 Jan 2017 10:51:56 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 11 Jan 2017 16:48:01 -0300 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 Acked-by: Wang Nan Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1483955520-29063-3-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-record.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 4ec10e9..f7e805b 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -46,6 +46,10 @@ #include #include +struct switch_output { + bool signal; +}; + struct record { struct perf_tool tool; struct record_opts opts; @@ -62,7 +66,7 @@ struct record { bool no_buildid_cache_set; bool buildid_all; bool timestamp_filename; - bool switch_output; + struct switch_output switch_output; unsigned long long samples; }; @@ -842,11 +846,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) signal(SIGTERM, sig_handler); signal(SIGSEGV, sigsegv_handler); - if (rec->opts.auxtrace_snapshot_mode || rec->switch_output) { + if (rec->opts.auxtrace_snapshot_mode || rec->switch_output.signal) { signal(SIGUSR2, snapshot_sig_handler); if (rec->opts.auxtrace_snapshot_mode) trigger_on(&auxtrace_snapshot_trigger); - if (rec->switch_output) + if (rec->switch_output.signal) trigger_on(&switch_output_trigger); } else { signal(SIGUSR2, SIG_IGN); @@ -1519,7 +1523,7 @@ static struct option __record_options[] = { "Record build-id of all DSOs regardless of hits"), OPT_BOOLEAN(0, "timestamp-filename", &record.timestamp_filename, "append timestamp to output filename"), - OPT_BOOLEAN(0, "switch-output", &record.switch_output, + OPT_BOOLEAN(0, "switch-output", &record.switch_output.signal, "Switch output when receive SIGUSR2"), OPT_BOOLEAN(0, "dry-run", &dry_run, "Parse options then exit"), @@ -1578,7 +1582,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) return -EINVAL; } - if (rec->switch_output) + if (rec->switch_output.signal) rec->timestamp_filename = true; if (!rec->itr) { @@ -1629,7 +1633,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) if (rec->no_buildid_cache || rec->no_buildid) { disable_buildid_cache(); - } else if (rec->switch_output) { + } else if (rec->switch_output.signal) { /* * In 'perf record --switch-output', disable buildid * generation by default to reduce data file switching