From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@kernel.org, namhyung@kernel.org,
linux-kernel@vger.kernel.org, hpa@zytor.com,
peterz@infradead.org, tglx@linutronix.de, acme@redhat.com,
mingo@kernel.org, alexander.shishkin@linux.intel.com,
dsahern@gmail.com, eranian@google.com, ak@linux.intel.com
Subject: [tip:perf/urgent] perf record: Fix period option handling
Date: Mon, 5 Feb 2018 13:36:26 -0800 [thread overview]
Message-ID: <tip-f290aa1ffa45ed7e37599840878b4dae68269ee1@git.kernel.org> (raw)
In-Reply-To: <20180201083812.11359-3-jolsa@kernel.org>
Commit-ID: f290aa1ffa45ed7e37599840878b4dae68269ee1
Gitweb: https://git.kernel.org/tip/f290aa1ffa45ed7e37599840878b4dae68269ee1
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Thu, 1 Feb 2018 09:38:11 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Feb 2018 12:18:28 -0300
perf record: Fix period option handling
Stephan reported we don't unset PERIOD sample type when --no-period is
specified. Adding the unset check and reset PERIOD if --no-period is
specified.
Committer notes:
Check the sample_type, it shouldn't have PERF_SAMPLE_PERIOD there when
--no-period is used.
Before:
# perf record --no-period sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.018 MB perf.data (7 samples) ]
# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
#
After:
[root@jouet ~]# perf record --no-period sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.019 MB perf.data (17 samples) ]
[root@jouet ~]# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
[root@jouet ~]#
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Stephane Eranian <eranian@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180201083812.11359-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 3 ++-
tools/perf/perf.h | 1 +
tools/perf/util/evsel.c | 11 ++++++++---
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 65681a1..bf4ca74 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1566,7 +1566,8 @@ static struct option __record_options[] = {
OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time,
&record.opts.sample_time_set,
"Record the sample timestamps"),
- OPT_BOOLEAN('P', "period", &record.opts.period, "Record the sample period"),
+ OPT_BOOLEAN_SET('P', "period", &record.opts.period, &record.opts.period_set,
+ "Record the sample period"),
OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples,
"don't sample"),
OPT_BOOLEAN_SET('N', "no-buildid-cache", &record.no_buildid_cache,
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 2357f4cc..cfe4623 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -50,6 +50,7 @@ struct record_opts {
bool sample_time_set;
bool sample_cpu;
bool period;
+ bool period_set;
bool running_time;
bool full_auxtrace;
bool auxtrace_snapshot_mode;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f2f2eaa..ff359c9 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -971,9 +971,6 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
if (target__has_cpu(&opts->target) || opts->sample_cpu)
perf_evsel__set_sample_bit(evsel, CPU);
- if (opts->period)
- perf_evsel__set_sample_bit(evsel, PERIOD);
-
/*
* When the user explicitly disabled time don't force it here.
*/
@@ -1075,6 +1072,14 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
apply_config_terms(evsel, opts, track);
evsel->ignore_missing_thread = opts->ignore_missing_thread;
+
+ /* The --period option takes the precedence. */
+ if (opts->period_set) {
+ if (opts->period)
+ perf_evsel__set_sample_bit(evsel, PERIOD);
+ else
+ perf_evsel__reset_sample_bit(evsel, PERIOD);
+ }
}
static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
next prev parent reply other threads:[~2018-02-05 21:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 8:38 [PATCH 0/3] perf: PEBS/period freerunning fixes Jiri Olsa
2018-02-01 8:38 ` [PATCH 1/3] perf tools: Fix period/freq terms setup Jiri Olsa
2018-02-02 18:45 ` Stephane Eranian
2018-02-02 20:28 ` Arnaldo Carvalho de Melo
2018-02-02 20:40 ` Arnaldo Carvalho de Melo
2018-02-02 21:04 ` Stephane Eranian
2018-02-05 15:17 ` Jiri Olsa
2018-02-05 20:58 ` Stephane Eranian
2018-02-05 21:13 ` Arnaldo Carvalho de Melo
2018-02-06 2:51 ` Stephane Eranian
2018-02-06 9:35 ` Jiri Olsa
2018-02-07 18:52 ` Stephane Eranian
2018-02-09 9:27 ` [PATCH] perf report: Add support to display group output for non group events Jiri Olsa
2018-02-09 18:37 ` Arnaldo Carvalho de Melo
2018-02-09 18:43 ` Arnaldo Carvalho de Melo
2018-02-09 19:10 ` Jiri Olsa
2018-02-09 19:12 ` Arnaldo Carvalho de Melo
2018-02-17 11:23 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-02-03 15:30 ` [PATCH 1/3] perf tools: Fix period/freq terms setup Jiri Olsa
2018-02-04 0:19 ` Stephane Eranian
2018-02-05 21:35 ` [tip:perf/urgent] perf evsel: " tip-bot for Jiri Olsa
2018-02-01 8:38 ` [PATCH 2/3] perf record: Fix period option handling Jiri Olsa
2018-02-05 21:36 ` tip-bot for Jiri Olsa [this message]
2018-02-01 8:38 ` [PATCH 3/3] x86/events/intel/ds: Add PERF_SAMPLE_PERIOD into PEBS_FREERUNNING_FLAGS Jiri Olsa
2018-02-05 21:36 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-f290aa1ffa45ed7e37599840878b4dae68269ee1@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).