From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Jiri Olsa <jolsa@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/10] perf evsel: Fix period/freq terms setup
Date: Mon, 5 Feb 2018 16:56:16 -0300 [thread overview]
Message-ID: <20180205195620.9010-7-acme@kernel.org> (raw)
In-Reply-To: <20180205195620.9010-1-acme@kernel.org>
From: Jiri Olsa <jolsa@kernel.org>
Stephane reported that we don't set properly PERIOD sample type for
events with period term defined.
Before:
$ perf record -e cpu/cpu-cycles,period=1000/u ls
$ perf evlist -v
cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME|PERIOD, ...
After:
$ perf record -e cpu/cpu-cycles,period=1000/u ls
$ perf evlist -v
cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME, ...
Setting PERIOD sample type based on period term setup.
Committer note:
When we use -c or a period=N term in the event definition, then we don't
need to ask the kernel, for this event, via perf_event_attr.sample_type
|= PERF_SAMPLE_PERIOD, to put the event period in each sample for this
event, as we know it already, it is in perf_event_attr.sample_period.
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
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-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 66fa45198a11..f2f2eaafde6d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -745,12 +745,14 @@ static void apply_config_terms(struct perf_evsel *evsel,
if (!(term->weak && opts->user_interval != ULLONG_MAX)) {
attr->sample_period = term->val.period;
attr->freq = 0;
+ perf_evsel__reset_sample_bit(evsel, PERIOD);
}
break;
case PERF_EVSEL__CONFIG_TERM_FREQ:
if (!(term->weak && opts->user_freq != UINT_MAX)) {
attr->sample_freq = term->val.freq;
attr->freq = 1;
+ perf_evsel__set_sample_bit(evsel, PERIOD);
}
break;
case PERF_EVSEL__CONFIG_TERM_TIME:
--
2.14.3
next prev parent reply other threads:[~2018-02-05 19:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 19:56 [GIT PULL 00/10] perf/urgent fixes Arnaldo Carvalho de Melo
2018-02-05 19:56 ` [PATCH 01/10] tools headers: Synchronize sound/asound.h Arnaldo Carvalho de Melo
2018-02-05 19:56 ` [PATCH 02/10] tooling headers: Synchronize updated s390 kvm UAPI headers Arnaldo Carvalho de Melo
2018-02-06 8:42 ` Christian Borntraeger
2018-02-06 10:53 ` Ingo Molnar
2018-02-05 19:56 ` [PATCH 03/10] tools headers: Sync {tools/,}arch/powerpc/include/uapi/asm/kvm.h Arnaldo Carvalho de Melo
2018-02-05 19:56 ` [PATCH 04/10] tools headers: Synchronize uapi/linux/sched.h Arnaldo Carvalho de Melo
2018-02-05 19:56 ` [PATCH 05/10] tools headers: Synchoronize x86 features UAPI headers Arnaldo Carvalho de Melo
2018-02-06 10:10 ` David Woodhouse
2018-02-06 10:54 ` Ingo Molnar
2018-02-05 19:56 ` Arnaldo Carvalho de Melo [this message]
2018-02-05 19:56 ` [PATCH 07/10] perf record: Fix period option handling Arnaldo Carvalho de Melo
2018-02-05 19:56 ` [PATCH 08/10] x86/events/intel/ds: Add PERF_SAMPLE_PERIOD into PEBS_FREERUNNING_FLAGS Arnaldo Carvalho de Melo
2018-02-05 19:56 ` [PATCH 09/10] perf trace: Fix call-graph output Arnaldo Carvalho de Melo
2018-02-05 19:56 ` [PATCH 10/10] perf tools: Add trace/beauty/generated/ into .gitignore Arnaldo Carvalho de Melo
2018-02-05 21:28 ` [GIT PULL 00/10] perf/urgent fixes Ingo Molnar
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=20180205195620.9010-7-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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).