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;
* 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 */
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;
+}
#include "arm-spe.h"
#include "hisi-ptt.h"
#include "../../../util/pmu.h"
+#include "../cs-etm.h"
struct perf_event_attr
*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) {
/* add ETM default config here */
pmu->selectable = true;
+ return cs_etm_get_default_config(pmu);
#if defined(__aarch64__)
} else if (strstarts(pmu->name, ARM_SPE_PMU_NAME)) {
return arm_spe_pmu_default_config(pmu);
#include <linux/bits.h>
struct perf_session;
+struct perf_pmu;
/*
* Versioning header in case things need to change in the future. That way
int cs_etm__process_auxtrace_info(union perf_event *event,
struct perf_session *session);
+struct perf_event_attr *cs_etm_get_default_config(struct perf_pmu *pmu);
#ifdef HAVE_CSTRACE_SUPPORT
int cs_etm__get_cpu(u8 trace_chan_id, int *cpu);