summaryrefslogtreecommitdiff
path: root/tools/perf/arch/arm/util/cs-etm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/arch/arm/util/cs-etm.c')
-rw-r--r--tools/perf/arch/arm/util/cs-etm.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index af0a2400c655..77cb03e6ff87 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -324,8 +324,6 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
perf_can_record_switch_events())
opts->record_switch_events = true;
- cs_etm_evsel->core.attr.freq = 0;
- cs_etm_evsel->core.attr.sample_period = 1;
cs_etm_evsel->needs_auxtrace_mmap = true;
opts->full_auxtrace = true;
@@ -430,10 +428,10 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
* when a context switch happened.
*/
if (!perf_cpu_map__empty(cpus)) {
- cs_etm_evsel->core.attr.config |=
- perf_pmu__format_bits(&cs_etm_pmu->format, "timestamp");
- cs_etm_evsel->core.attr.config |=
- perf_pmu__format_bits(&cs_etm_pmu->format, "contextid");
+ evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel,
+ "timestamp", 1);
+ evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel,
+ "contextid", 1);
}
/* Add dummy event to keep tracking */
@@ -914,3 +912,22 @@ struct auxtrace_record *cs_etm_record_init(int *err)
out:
return NULL;
}
+
+/*
+ * Set a default config to enable the user changed config tracking mechanism
+ * (CFG_CHG and evsel__set_config_if_unset()). If no default is set then user
+ * changes aren't tracked.
+ */
+struct perf_event_attr *
+cs_etm_get_default_config(struct perf_pmu *pmu __maybe_unused)
+{
+ struct perf_event_attr *attr;
+
+ attr = zalloc(sizeof(struct perf_event_attr));
+ if (!attr)
+ return NULL;
+
+ attr->sample_period = 1;
+
+ return attr;
+}