From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756264AbbI2Iwu (ORCPT ); Tue, 29 Sep 2015 04:52:50 -0400 Received: from terminus.zytor.com ([198.137.202.10]:37708 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933400AbbI2Iln (ORCPT ); Tue, 29 Sep 2015 04:41:43 -0400 Date: Tue, 29 Sep 2015 01:41:29 -0700 From: tip-bot for Adrian Hunter Message-ID: Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, adrian.hunter@intel.com, tglx@linutronix.de, jolsa@redhat.com, acme@redhat.com, hpa@zytor.com Reply-To: mingo@kernel.org, adrian.hunter@intel.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, jolsa@redhat.com, acme@redhat.com, hpa@zytor.com In-Reply-To: <1443186956-18718-2-git-send-email-adrian.hunter@intel.com> References: <1443186956-18718-2-git-send-email-adrian.hunter@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf auxtrace: Fix 'instructions' period of zero Git-Commit-ID: e1791347b5d57d13326cf0114df1a3f3b1c4ca24 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: e1791347b5d57d13326cf0114df1a3f3b1c4ca24 Gitweb: http://git.kernel.org/tip/e1791347b5d57d13326cf0114df1a3f3b1c4ca24 Author: Adrian Hunter AuthorDate: Fri, 25 Sep 2015 16:15:32 +0300 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 28 Sep 2015 15:50:56 -0300 perf auxtrace: Fix 'instructions' period of zero Instruction tracing options (i.e. --itrace) include an option for sampling instructions at an arbitrary period. e.g. --itrace=i10us means make an 'instructions' sample for every 10us of trace. Currently the logic does not distinguish between a period of zero and no period being specified at all, so it gets treated as the default period which is 100000. That doesn't really make sense. Fix it so that zero period is accepted and treated as meaning "as often as possible". In the case of Intel PT that is the same as a period of 1 and a unit of 'instructions' (i.e. --itrace=i1i). Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lkml.kernel.org/r/1443186956-18718-2-git-send-email-adrian.hunter@intel.com [ Add a few lines describing this in the Documentation/intel-pt.txt file ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/intel-pt.txt | 5 +++++ tools/perf/util/auxtrace.c | 4 +++- tools/perf/util/intel-pt.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/Documentation/intel-pt.txt b/tools/perf/Documentation/intel-pt.txt index c94c9de..886612b 100644 --- a/tools/perf/Documentation/intel-pt.txt +++ b/tools/perf/Documentation/intel-pt.txt @@ -707,6 +707,11 @@ on the sample is *not* adjusted and reflects the last known value of TSC. For Intel PT, the default period is 100us. +Setting it to a zero period means "as often as possible". + +In the case of Intel PT that is the same as a period of 1 and a unit of +'instructions' (i.e. --itrace=i1i). + Also the call chain size (default 16, max. 1024) for instructions or transactions events can be specified. e.g. diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index a980e7c..c4993b2 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -950,6 +950,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str, const char *p; char *endptr; bool period_type_set = false; + bool period_set = false; synth_opts->set = true; @@ -971,6 +972,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str, p += 1; if (isdigit(*p)) { synth_opts->period = strtoull(p, &endptr, 10); + period_set = true; p = endptr; while (*p == ' ' || *p == ',') p += 1; @@ -1053,7 +1055,7 @@ out: if (!period_type_set) synth_opts->period_type = PERF_ITRACE_DEFAULT_PERIOD_TYPE; - if (!synth_opts->period) + if (!period_set) synth_opts->period = PERF_ITRACE_DEFAULT_PERIOD; } diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 38942e1..c8bb5ca 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -720,7 +720,7 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt, if (!params.period) { params.period_type = INTEL_PT_PERIOD_INSTRUCTIONS; - params.period = 1000; + params.period = 1; } }