}
default_ps.pmu_glob = old_pmu_glob;
} else if (strcmp(argv[i], "cache") == 0 ||
- strcmp(argv[i], "hwcache") == 0)
- print_hwcache_events(&print_cb, ps);
- else if (strcmp(argv[i], "pmu") == 0) {
+ strcmp(argv[i], "hwcache") == 0) {
+ char *old_event_glob = default_ps.event_glob;
+
+ default_ps.event_glob = strdup("legacy cache");
+ if (!default_ps.event_glob) {
+ ret = -1;
+ goto out;
+ }
+ perf_pmus__print_pmu_events(&print_cb, ps);
+ zfree(&default_ps.event_glob);
+ default_ps.event_glob = old_event_glob;
+ } else if (strcmp(argv[i], "pmu") == 0) {
default_ps.exclude_abi = true;
perf_pmus__print_pmu_events(&print_cb, ps);
default_ps.exclude_abi = false;
default_ps.event_glob = s;
print_symbol_events(&print_cb, ps, PERF_TYPE_HARDWARE,
event_symbols_hw, PERF_COUNT_HW_MAX);
- print_hwcache_events(&print_cb, ps);
perf_pmus__print_pmu_events(&print_cb, ps);
print_sdt_events(&print_cb, ps);
default_ps.metrics = true;
return ret;
}
-int print_hwcache_events(const struct print_callbacks *print_cb, void *print_state)
-{
- struct perf_pmu *pmu = NULL;
- const char *event_type_descriptor = event_type_descriptors[PERF_TYPE_HW_CACHE];
-
- /*
- * Only print core PMUs, skipping uncore for performance and
- * PERF_TYPE_SOFTWARE that can succeed in opening legacy cache evenst.
- */
- while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
- if (pmu->is_uncore || pmu->type == PERF_TYPE_SOFTWARE)
- continue;
-
- for (int type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) {
- for (int op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
- /* skip invalid cache type */
- if (!evsel__is_cache_op_valid(type, op))
- continue;
-
- for (int res = 0; res < PERF_COUNT_HW_CACHE_RESULT_MAX; res++) {
- char name[64];
- char alias_name[128];
- __u64 config;
- int ret;
-
- __evsel__hw_cache_type_op_res_name(type, op, res,
- name, sizeof(name));
-
- ret = parse_events__decode_legacy_cache(name, pmu->type,
- &config);
- if (ret || !is_event_supported(PERF_TYPE_HW_CACHE, config))
- continue;
- snprintf(alias_name, sizeof(alias_name), "%s/%s/",
- pmu->name, name);
- print_cb->print_event(print_state,
- "cache",
- pmu->name,
- pmu->type,
- name,
- alias_name,
- /*scale_unit=*/NULL,
- /*deprecated=*/false,
- event_type_descriptor,
- /*desc=*/NULL,
- /*long_desc=*/NULL,
- /*encoding_desc=*/NULL);
- }
- }
- }
- }
- return 0;
-}
-
void print_symbol_events(const struct print_callbacks *print_cb, void *print_state,
unsigned int type, const struct event_symbol *syms,
unsigned int max)
print_symbol_events(print_cb, print_state, PERF_TYPE_HARDWARE,
event_symbols_hw, PERF_COUNT_HW_MAX);
- print_hwcache_events(print_cb, print_state);
-
perf_pmus__print_pmu_events(print_cb, print_state);
print_cb->print_event(print_state,
/** Print all events, the default when no options are specified. */
void print_events(const struct print_callbacks *print_cb, void *print_state);
-int print_hwcache_events(const struct print_callbacks *print_cb, void *print_state);
void print_sdt_events(const struct print_callbacks *print_cb, void *print_state);
void print_symbol_events(const struct print_callbacks *print_cb, void *print_state,
unsigned int type, const struct event_symbol *syms,