* [PATCH] perf: cs-etm: Optimize option setup for CPU-wide sessions
@ 2019-06-11 20:45 Mathieu Poirier
2019-06-22 6:35 ` [tip:perf/core] " tip-bot for Mathieu Poirier
0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Poirier @ 2019-06-11 20:45 UTC (permalink / raw)
To: acme
Cc: suzuki.poulose, peterz, mingo, alexander.shishkin, jolsa,
namhyung, linux-arm-kernel, linux-kernel
Call function cs_etm_set_option() once with all relevant options set rather
than multiple times to avoid going through the list of CPU more than once.
Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
tools/perf/arch/arm/util/cs-etm.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index 279c69caef91..c6f1ab5499b5 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -162,20 +162,19 @@ static int cs_etm_set_option(struct auxtrace_record *itr,
!cpu_map__has(online_cpus, i))
continue;
- switch (option) {
- case ETM_OPT_CTXTID:
+ if (option & ETM_OPT_CTXTID) {
err = cs_etm_set_context_id(itr, evsel, i);
if (err)
goto out;
- break;
- case ETM_OPT_TS:
+ }
+ if (option & ETM_OPT_TS) {
err = cs_etm_set_timestamp(itr, evsel, i);
if (err)
goto out;
- break;
- default:
- goto out;
}
+ if (option & ~(ETM_OPT_CTXTID | ETM_OPT_TS))
+ /* Nothing else is currently supported */
+ goto out;
}
err = 0;
@@ -398,11 +397,8 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
if (!cpu_map__empty(cpus)) {
perf_evsel__set_sample_bit(cs_etm_evsel, CPU);
- err = cs_etm_set_option(itr, cs_etm_evsel, ETM_OPT_CTXTID);
- if (err)
- goto out;
-
- err = cs_etm_set_option(itr, cs_etm_evsel, ETM_OPT_TS);
+ err = cs_etm_set_option(itr, cs_etm_evsel,
+ ETM_OPT_CTXTID | ETM_OPT_TS);
if (err)
goto out;
}
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:perf/core] perf: cs-etm: Optimize option setup for CPU-wide sessions
2019-06-11 20:45 [PATCH] perf: cs-etm: Optimize option setup for CPU-wide sessions Mathieu Poirier
@ 2019-06-22 6:35 ` tip-bot for Mathieu Poirier
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Mathieu Poirier @ 2019-06-22 6:35 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, mathieu.poirier, acme, hpa, linux-kernel,
alexander.shishkin, jolsa, namhyung, suzuki.poulose, mingo,
peterz
Commit-ID: 374d910f87b87283df2b1e8a60a6a546d4a14c90
Gitweb: https://git.kernel.org/tip/374d910f87b87283df2b1e8a60a6a546d4a14c90
Author: Mathieu Poirier <mathieu.poirier@linaro.org>
AuthorDate: Tue, 11 Jun 2019 14:45:28 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 Jun 2019 15:57:16 -0300
perf: cs-etm: Optimize option setup for CPU-wide sessions
Call function cs_etm_set_option() once with all relevant options set
rather than multiple times to avoid going through the list of CPU more
than once.
Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190611204528.20093-1-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/arm/util/cs-etm.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index 279c69caef91..c6f1ab5499b5 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -162,20 +162,19 @@ static int cs_etm_set_option(struct auxtrace_record *itr,
!cpu_map__has(online_cpus, i))
continue;
- switch (option) {
- case ETM_OPT_CTXTID:
+ if (option & ETM_OPT_CTXTID) {
err = cs_etm_set_context_id(itr, evsel, i);
if (err)
goto out;
- break;
- case ETM_OPT_TS:
+ }
+ if (option & ETM_OPT_TS) {
err = cs_etm_set_timestamp(itr, evsel, i);
if (err)
goto out;
- break;
- default:
- goto out;
}
+ if (option & ~(ETM_OPT_CTXTID | ETM_OPT_TS))
+ /* Nothing else is currently supported */
+ goto out;
}
err = 0;
@@ -398,11 +397,8 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
if (!cpu_map__empty(cpus)) {
perf_evsel__set_sample_bit(cs_etm_evsel, CPU);
- err = cs_etm_set_option(itr, cs_etm_evsel, ETM_OPT_CTXTID);
- if (err)
- goto out;
-
- err = cs_etm_set_option(itr, cs_etm_evsel, ETM_OPT_TS);
+ err = cs_etm_set_option(itr, cs_etm_evsel,
+ ETM_OPT_CTXTID | ETM_OPT_TS);
if (err)
goto out;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-22 6:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 20:45 [PATCH] perf: cs-etm: Optimize option setup for CPU-wide sessions Mathieu Poirier
2019-06-22 6:35 ` [tip:perf/core] " tip-bot for Mathieu Poirier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®