Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1232819

[PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero

From Adrian Hunter <adrian.hunter@intel.com>
Newsgroups linux.kernel
Subject [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero
Date 2015-09-25 15:30 +0200
Message-ID <qcBez-2Eq-61@gated-at.bofh.it> (permalink)
References <qcB4S-2t3-5@gated-at.bofh.it>
Organization Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki

Show all headers | View raw


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 <adrian.hunter@intel.com>
---
 tools/perf/util/auxtrace.c | 4 +++-
 tools/perf/util/intel-pt.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index a980e7c50ee0..c4993b2e6c50 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 38942e1eac8f..c8bb5ca6a157 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;
 		}
 	}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/25] perf tools: minor improvements to Intel PT related stuff Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
  [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    Re: [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 16:20 +0200
    Re: [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 16:20 +0200
    [tip:perf/core] perf auxtrace: Fix 'instructions' period of zero tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 11:00 +0200
  [PATCH 12/25] perf inject: Set branch stack feature flag when synthesizing branch stacks Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf inject:   Set branch stack feature flag when synthesizing branch stacks tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 04/25] perf intel-pt: Make logging slightly more efficient Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf intel-pt:   Make logging slightly more efficient tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 07/25] perf tools: Add more documentation to export-to-postgresql.py script Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf tools:   Add more documentation to export-to-postgresql.py script tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 21/25] perf tools: Add perf_evlist__id2evsel_strict() Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf evlist: Add perf_evlist__id2evsel_strict() tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 14/25] perf intel-pt: Support generating branch stack Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf intel-pt: Support generating branch stack tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  Re: [PATCH 00/25] perf tools: minor improvements to Intel PT related  stuff Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 22:40 +0200
    Re: [PATCH 00/25] perf tools: minor improvements to Intel PT related  stuff Adrian Hunter <adrian.hunter@intel.com> - 2015-09-29 13:20 +0200

csiph-web