[PATCH v1 10/10] perf evsel: Remove use_uncore_alias

From: Ian Rogers
Date: Wed Mar 01 2023 - 23:15:27 EST


This flag used to be used when regrouping uncore events in particular
due to wildcard matches. This is now handled by sorting evlist and so
the flag is redundant.

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/util/evsel.c | 1 -
tools/perf/util/evsel.h | 1 -
tools/perf/util/parse-events.c | 12 +++---------
tools/perf/util/parse-events.h | 3 +--
tools/perf/util/parse-events.y | 11 +++++++----
5 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 9c6b486f8bd4..5446128be03b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -458,7 +458,6 @@ struct evsel *evsel__clone(struct evsel *orig)
evsel->per_pkg = orig->per_pkg;
evsel->percore = orig->percore;
evsel->precise_max = orig->precise_max;
- evsel->use_uncore_alias = orig->use_uncore_alias;
evsel->is_libpfm_event = orig->is_libpfm_event;

evsel->exclude_GH = orig->exclude_GH;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 72121194d3b1..9a8d08fcad1c 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -89,7 +89,6 @@ struct evsel {
bool per_pkg;
bool percore;
bool precise_max;
- bool use_uncore_alias;
bool is_libpfm_event;
bool auto_merge_stats;
bool collect_stat;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d6eb0a54dd2d..ac7709c1c5b7 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1445,15 +1445,13 @@ static int parse_events__inside_hybrid_pmu(struct parse_events_state *parse_stat
int parse_events_add_pmu(struct parse_events_state *parse_state,
struct list_head *list, char *name,
struct list_head *head_config,
- bool auto_merge_stats,
- bool use_alias)
+ bool auto_merge_stats)
{
struct perf_event_attr attr;
struct perf_pmu_info info;
struct perf_pmu *pmu;
struct evsel *evsel;
struct parse_events_error *err = parse_state->error;
- bool use_uncore_alias;
LIST_HEAD(config_terms);

pmu = parse_state->fake_pmu ?: perf_pmu__find(name);
@@ -1488,8 +1486,6 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
memset(&attr, 0, sizeof(attr));
}

- use_uncore_alias = (pmu->is_uncore && use_alias);
-
if (!head_config) {
attr.type = pmu->type;
evsel = __add_event(list, &parse_state->idx, &attr,
@@ -1499,7 +1495,6 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
/*cpu_list=*/NULL);
if (evsel) {
evsel->pmu_name = name ? strdup(name) : NULL;
- evsel->use_uncore_alias = use_uncore_alias;
return 0;
} else {
return -ENOMEM;
@@ -1560,7 +1555,6 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
evsel->use_config_name = true;

evsel->pmu_name = name ? strdup(name) : NULL;
- evsel->use_uncore_alias = use_uncore_alias;
evsel->percore = config_term_percore(&evsel->config_terms);

if (parse_state->fake_pmu)
@@ -1622,7 +1616,7 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
parse_events_copy_term_list(head, &orig_head);
if (!parse_events_add_pmu(parse_state, list,
pmu->name, orig_head,
- true, true)) {
+ /*auto_merge_stats=*/true)) {
pr_debug("%s -> %s/%s/\n", str,
pmu->name, alias->str);
ok++;
@@ -1634,7 +1628,7 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,

if (parse_state->fake_pmu) {
if (!parse_events_add_pmu(parse_state, list, str, head,
- true, true)) {
+ /*auto_merge_stats=*/true)) {
pr_debug("%s -> %s/%s/\n", str, "fake_pmu", str);
ok++;
}
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 22fc11b0bd59..fdac44dc696b 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -183,8 +183,7 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx,
int parse_events_add_pmu(struct parse_events_state *parse_state,
struct list_head *list, char *name,
struct list_head *head_config,
- bool auto_merge_stats,
- bool use_alias);
+ bool auto_merge_stats);

struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr,
const char *name, const char *metric_id,
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 90d12f2bc8be..f1b153c72d67 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -313,7 +313,7 @@ event_pmu_name opt_pmu_config
list = alloc_list();
if (!list)
CLEANUP_YYABORT;
- if (parse_events_add_pmu(_parse_state, list, $1, $2, false, false)) {
+ if (parse_events_add_pmu(_parse_state, list, $1, $2, /*auto_merge_stats=*/false)) {
struct perf_pmu *pmu = NULL;
int ok = 0;

@@ -330,8 +330,10 @@ event_pmu_name opt_pmu_config
!perf_pmu__match(pattern, pmu->alias_name, $1)) {
if (parse_events_copy_term_list(orig_terms, &terms))
CLEANUP_YYABORT;
- if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true, false))
+ if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms,
+ /*auto_merge_stats=*/true)) {
ok++;
+ }
parse_events_terms__delete(terms);
}
}
@@ -407,7 +409,8 @@ PE_PMU_EVENT_FAKE sep_dc
if (!list)
YYABORT;

- err = parse_events_add_pmu(_parse_state, list, $1, NULL, false, false);
+ err = parse_events_add_pmu(_parse_state, list, $1, /*head_config=*/NULL,
+ /*auto_merge_stats=*/false);
free($1);
if (err < 0) {
free(list);
@@ -425,7 +428,7 @@ PE_PMU_EVENT_FAKE opt_pmu_config
if (!list)
YYABORT;

- err = parse_events_add_pmu(_parse_state, list, $1, $2, false, false);
+ err = parse_events_add_pmu(_parse_state, list, $1, $2, /*auto_merge_stats=*/false);
free($1);
parse_events_terms__delete($2);
if (err < 0) {
--
2.39.2.722.g9855ee24e9-goog