From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, linux-kernel@vger.kernel.org,
mingo@kernel.org, ak@linux.intel.com, kan.liang@intel.com,
acme@redhat.com, hpa@zytor.com, jolsa@kernel.org,
tglx@linutronix.de
Subject: [tip:perf/core] perf tools: Force period term to overload global settings
Date: Fri, 31 Jul 2015 06:54:35 -0700 [thread overview]
Message-ID: <tip-ee4c75887d12bcd6ecd897291797d969256f39ca@git.kernel.org> (raw)
In-Reply-To: <1438162936-59698-3-git-send-email-kan.liang@intel.com>
Commit-ID: ee4c75887d12bcd6ecd897291797d969256f39ca
Gitweb: http://git.kernel.org/tip/ee4c75887d12bcd6ecd897291797d969256f39ca
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 29 Jul 2015 05:42:11 -0400
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 29 Jul 2015 16:18:21 -0300
perf tools: Force period term to overload global settings
Currently the command line option settings beats the per event period
settings:
With no global settings, we get per-event configuration:
$ perf record -e 'cpu/instructions,period=20000/' sleep 1
$ perf evlist -v
... { sample_period, sample_freq }: 20000 ...
With 'c' option period setup, we get 'c' option value:
$ perf record -e 'cpu/instructions,period=20000/' -c 1000 sleep 1
$ perf evlist -v
... { sample_period, sample_freq }: 1000 ...
This patch makes the per-event settings overload the global 'c' option
setup:
$ perf record -e 'cpu/instructions,period=20000/' -c 1000 sleep 1
$ perf evlist -v
... { sample_period, sample_freq }: 20000 ...
I think the making the per-event settings to overload any other config
makes more sense than current state. However it breaks the current
'period' term handling, which might cause some noise.. so let's see ;-).
Also fixing parse event tests with the new behaviour.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1438162936-59698-3-git-send-email-kan.liang@intel.com
Signed-off-by: Kan Liang <kan.liang@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-record.txt | 2 +-
tools/perf/tests/parse-events.c | 12 ++++++++++--
tools/perf/util/evsel.c | 2 ++
tools/perf/util/evsel.h | 1 +
tools/perf/util/parse-events.c | 3 ++-
5 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 63ee040..ac41350 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -46,7 +46,7 @@ OPTIONS
/sys/bus/event_sources/devices/<pmu>/format/*
There are also some params which are not defined in .../<pmu>/format/*.
- These params can be used to set event defaults.
+ These params can be used to overload default config values per event.
Here is a list of the params.
- 'period': Set event sampling period
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index d76963f..f65bb89 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -82,8 +82,12 @@ static int test__checkevent_symbolic_name_config(struct perf_evlist *evlist)
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
TEST_ASSERT_VAL("wrong config",
PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
+ /*
+ * The period value gets configured within perf_evlist__config,
+ * while this test executes only parse events method.
+ */
TEST_ASSERT_VAL("wrong period",
- 100000 == evsel->attr.sample_period);
+ 0 == evsel->attr.sample_period);
TEST_ASSERT_VAL("wrong config1",
0 == evsel->attr.config1);
TEST_ASSERT_VAL("wrong config2",
@@ -406,7 +410,11 @@ static int test__checkevent_pmu(struct perf_evlist *evlist)
TEST_ASSERT_VAL("wrong config", 10 == evsel->attr.config);
TEST_ASSERT_VAL("wrong config1", 1 == evsel->attr.config1);
TEST_ASSERT_VAL("wrong config2", 3 == evsel->attr.config2);
- TEST_ASSERT_VAL("wrong period", 1000 == evsel->attr.sample_period);
+ /*
+ * The period value gets configured within perf_evlist__config,
+ * while this test executes only parse events method.
+ */
+ TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period);
return 0;
}
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 048d61d..7d3acba 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -594,6 +594,8 @@ static void apply_config_terms(struct perf_event_attr *attr __maybe_unused,
list_for_each_entry(term, config_terms, list) {
switch (term->type) {
+ case PERF_EVSEL__CONFIG_TERM_PERIOD:
+ attr->sample_period = term->val.period;
default:
break;
}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 0339819..a7d2175 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -38,6 +38,7 @@ struct cgroup_sel;
* perf_evsel::config_terms list head.
*/
enum {
+ PERF_EVSEL__CONFIG_TERM_PERIOD,
PERF_EVSEL__CONFIG_TERM_MAX,
};
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 3271d13..09bee93 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -596,7 +596,6 @@ do { \
break;
case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
CHECK_TYPE_VAL(NUM);
- attr->sample_period = term->val.num;
break;
case PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE:
/*
@@ -649,6 +648,8 @@ do { \
list_for_each_entry(term, head_config, list) {
switch (term->type_term) {
+ case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
+ ADD_CONFIG_TERM(PERIOD, period, term->val.num);
default:
break;
}
next prev parent reply other threads:[~2015-07-31 13:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 9:42 [PATCH RFC V7 0/7] per event callgraph and time support Kan Liang
2015-07-29 9:42 ` [PATCH RFC V7 1/7] perf tools: Add support for event post configuration Kan Liang
2015-07-31 13:54 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-07-29 9:42 ` [PATCH RFC V7 2/7] perf tools: Force period term to overload global settings Kan Liang
2015-07-31 13:54 ` tip-bot for Jiri Olsa [this message]
2015-07-29 9:42 ` [PATCH RFC V7 3/7] perf,tools: introduce callgraph_set for callgraph option Kan Liang
2015-07-31 13:54 ` [tip:perf/core] perf tools: Introduce " tip-bot for Kan Liang
2015-07-29 9:42 ` [PATCH RFC V7 4/7] perf,tools: per-event time support Kan Liang
2015-07-29 9:42 ` [PATCH RFC V7 5/7] perf,tools: refine parse/config callchain functions Kan Liang
2015-07-29 9:42 ` [PATCH RFC V7 6/7] perf,tools: per-event callgraph support Kan Liang
2015-07-30 12:15 ` Jiri Olsa
2015-07-29 9:42 ` [PATCH RFC V7 7/7] perf,tests: Add tests to callgraph and time parse Kan Liang
2015-07-29 19:20 ` [PATCH RFC V7 0/7] per event callgraph and time support Arnaldo Carvalho de Melo
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-ee4c75887d12bcd6ecd897291797d969256f39ca@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.