From nobody Thu Nov 28 12:42:57 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A45839FC5 for ; Wed, 2 Oct 2024 03:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727839239; cv=none; b=suoxIZB2ZjBHXlQGGBDda9Pc8MumNVEvllW3OVERsSRuTtTyuWT9jYCwkJE0KALLUyjJxLRDT48zo4szI7xInE1i2AGLB2QENsDXUuqDdYiTV0+Tq8r7G7QvXO9V2gcaG4sD/NINYFc3HJUBN4MdfB2VImsXuYfTl8vkUeKyAPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727839239; c=relaxed/simple; bh=0g1nRVYc2P1gyjRrCJd52ixWbdM+SC58Z1dsoHnQioM=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=R8sz+DgYLpsRiA7slhpvpyFIdEpGOI40oloilJhurqSfFNXyGAmaLIGuY1q9UauSVgNVMouE8AvZkL4mXh5b1Baosu2FyaIfD5m4uBbaDNhJroD79PhY9E6XPbJ/g1WP7oueMp6I+04D8YohOy2ec1055C8ycr47xTmOjC0UP6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZOjGWkWY; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZOjGWkWY" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6d7124939beso100487227b3.2 for ; Tue, 01 Oct 2024 20:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727839236; x=1728444036; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=bF65nLXk1UolurWKQzuL9+6VFLZl4ud9B1SFXRw/LFg=; b=ZOjGWkWYUvP1dsfLeKbLLFIB1FgvN5BPvCKwzpqHQ21xu4M27imgphf9HrgGQDmu4G n5UYTPBnoi8FcEPvjwrH0t9zfCG7LgOsuFlt6RvPqNC5Z2KlYI8uyk1n012v8KfQUsgv A7UgmaG7xqEBDCREwuFtaXXs8hzDiRErF2tSO9BQqyRhFwSADW2WLI/2BoXZ0PV7y1CR BwRSxB85bR1eyk4MSUObK51qBNtLKAl2Gn85sKUbVcNwYPf+h1KhqABkOMoG9JT7FITP VCJPLdom0L3+UDP+j/KiW9smJjVpRgHMolZU4xwKsJkGNVlhI9B9wuUltIfSejVxIo6Q 2+9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727839236; x=1728444036; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bF65nLXk1UolurWKQzuL9+6VFLZl4ud9B1SFXRw/LFg=; b=B6GeD4zhbgGO2z21tEteerLt1g19niuFCbYyvl+zNTOC8fn1HN6BKEHzz6HQOD4+FY JhWSO5lH7e6x51CGgzbmQ4BQcxKX5GLrpSUSJfT0YNwZDYSnDxvZVjQg5da5K8YBD35G GlGUgEpvXy0+LptsS3ofhzWC6Cu1umB7ITbuva0teKOSAU/A0rSHkvOpwhEnkfOeIEPG 2AXSmvmFXJ62f66i5LWasLksMxHkfFGoSHW4ceZ6Bm6XknDYvd0WkSNcOZ5JI2lWtFZ0 Nax/OiIVejlgPLohhV8GYVgdY6iq1g7po/6QeMRrWNVqi46LwOWwI4neEhB72sZtZ5BZ 7xrQ== X-Forwarded-Encrypted: i=1; AJvYcCU/2Ca/n2dEoZvYd8c+CProv/P9SR4FDilcI+ETobB10eWr7U0m2IbkdDv3aKOKpKQqrOLX9AV9ubuyyhQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6jcjRF+43Y0LEYDmp4EUvLzLxe3DoZtTS9Y17nivxBKWpxeah umfkjsOcrpe/r7RfwnlEzzxlWUqXmiZVBiIpMUesTYN8JX0Xua0LLLpZJqk2UCsMt2LQdzXZyXb LobIgvg== X-Google-Smtp-Source: AGHT+IFaO8lHdOniNRTpaZuldspmldGJ3TH5FSCfkfLccbjjJ2qmbvropjIYlUbtldgOQhvjL8xdViilvcKa X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:ffa1:6d00:2acb:535f]) (user=irogers job=sendgmr) by 2002:a05:6902:10c7:b0:e24:a00a:518e with SMTP id 3f1490d57ef6-e263840d766mr9239276.7.1727839236256; Tue, 01 Oct 2024 20:20:36 -0700 (PDT) Date: Tue, 1 Oct 2024 20:20:09 -0700 In-Reply-To: <20241002032016.333748-1-irogers@google.com> Message-Id: <20241002032016.333748-7-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241002032016.333748-1-irogers@google.com> X-Mailer: git-send-email 2.46.1.824.gd892dcdcdd-goog Subject: [PATCH v3 06/13] perf tool_pmu: Rename perf_tool_event__* to tool_pmu__* From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Weilin Wang , Ravi Bangoria , Sandipan Das , Xu Yang , Benjamin Gray , Athira Jajeev , Howard Chu , Veronika Molnarova , "Dr. David Alan Gilbert" , Oliver Upton , Changbin Du , "Steinar H. Gunderson" , Ze Gao , Dominique Martinet , "=?UTF-8?q?Cl=C3=A9ment=20Le=20Goffic?=" , Sun Haiyong , Junhao He , Tiezhu Yang , Yicong Yang , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now the events are associated with the tool PMU, rename the functions to reflect this. Signed-off-by: Ian Rogers Acked-by: Namhyung Kim --- tools/perf/util/evsel.c | 2 +- tools/perf/util/metricgroup.c | 22 +++++++++++----------- tools/perf/util/pmu.c | 4 ++-- tools/perf/util/tool_pmu.c | 16 ++++++++-------- tools/perf/util/tool_pmu.h | 8 ++++---- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 59b2d38c9a65..e6fdbbb3398e 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1669,7 +1669,7 @@ bool __evsel__match(const struct evsel *evsel, u32 ty= pe, u64 config) int evsel__read_counter(struct evsel *evsel, int cpu_map_idx, int thread) { if (evsel__is_tool(evsel)) - return evsel__read_tool(evsel, cpu_map_idx, thread); + return evsel__tool_pmu_read(evsel, cpu_map_idx, thread); =20 if (evsel__is_retire_lat(evsel)) return evsel__read_retire_lat(evsel, cpu_map_idx, thread); diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 1250bf5050b0..46920ebadfd1 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -686,7 +686,7 @@ static int metricgroup__build_event_string(struct strbu= f *events, pr_debug("found event %s\n", id); =20 /* Always move tool events outside of the group. */ - ev =3D perf_tool_event__from_str(id); + ev =3D tool_pmu__str_to_event(id); if (ev !=3D TOOL_PMU__EVENT_NONE) { has_tool_events =3D true; tool_events[ev] =3D true; @@ -755,14 +755,14 @@ static int metricgroup__build_event_string(struct str= buf *events, if (has_tool_events) { int i; =20 - perf_tool_event__for_each_event(i) { + tool_pmu__for_each_event(i) { if (tool_events[i]) { if (!no_group) { ret =3D strbuf_addch(events, ','); RETURN_IF_NON_ZERO(ret); } no_group =3D false; - ret =3D strbuf_addstr(events, perf_tool_event__to_str(i)); + ret =3D strbuf_addstr(events, tool_pmu__event_to_str(i)); RETURN_IF_NON_ZERO(ret); } } @@ -1148,14 +1148,14 @@ static int metric_list_cmp(void *priv __maybe_unuse= d, const struct list_head *l, int i, left_count, right_count; =20 left_count =3D hashmap__size(left->pctx->ids); - perf_tool_event__for_each_event(i) { - if (!expr__get_id(left->pctx, perf_tool_event__to_str(i), &data)) + tool_pmu__for_each_event(i) { + if (!expr__get_id(left->pctx, tool_pmu__event_to_str(i), &data)) left_count--; } =20 right_count =3D hashmap__size(right->pctx->ids); - perf_tool_event__for_each_event(i) { - if (!expr__get_id(right->pctx, perf_tool_event__to_str(i), &data)) + tool_pmu__for_each_event(i) { + if (!expr__get_id(right->pctx, tool_pmu__event_to_str(i), &data)) right_count--; } =20 @@ -1382,11 +1382,11 @@ static void find_tool_events(const struct list_head= *metric_list, list_for_each_entry(m, metric_list, nd) { int i; =20 - perf_tool_event__for_each_event(i) { + tool_pmu__for_each_event(i) { struct expr_id_data *data; =20 if (!tool_events[i] && - !expr__get_id(m->pctx, perf_tool_event__to_str(i), &data)) + !expr__get_id(m->pctx, tool_pmu__event_to_str(i), &data)) tool_events[i] =3D true; } } @@ -1472,9 +1472,9 @@ static int parse_ids(bool metric_no_merge, bool fake_= pmu, * event1 if #smt_on else 0 * Add a tool event to avoid a parse error on an empty string. */ - perf_tool_event__for_each_event(i) { + tool_pmu__for_each_event(i) { if (tool_events[i]) { - char *tmp =3D strdup(perf_tool_event__to_str(i)); + char *tmp =3D strdup(tool_pmu__event_to_str(i)); =20 if (!tmp) return -ENOMEM; diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 77e848ac5841..d3c7a1c4254c 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1836,7 +1836,7 @@ bool perf_pmu__have_event(struct perf_pmu *pmu, const= char *name) if (!name) return false; if (perf_pmu__is_tool(pmu)) - return perf_tool_event__from_str(name) !=3D TOOL_PMU__EVENT_NONE; + return tool_pmu__str_to_event(name) !=3D TOOL_PMU__EVENT_NONE; if (perf_pmu__find_alias(pmu, name, /*load=3D*/ true) !=3D NULL) return true; if (pmu->cpu_aliases_added || !pmu->events_table) @@ -2331,7 +2331,7 @@ const char *perf_pmu__name_from_config(struct perf_pm= u *pmu, u64 config) return NULL; =20 if (perf_pmu__is_tool(pmu)) - return perf_tool_event__to_str(config); + return tool_pmu__event_to_str(config); =20 pmu_aliases_parse(pmu); pmu_add_cpu_aliases(pmu); diff --git a/tools/perf/util/tool_pmu.c b/tools/perf/util/tool_pmu.c index ae0ca023f5ed..2a1524dc2e31 100644 --- a/tools/perf/util/tool_pmu.c +++ b/tools/perf/util/tool_pmu.c @@ -20,7 +20,7 @@ static const char *const tool_pmu__event_names[TOOL_PMU__= EVENT_MAX] =3D { }; =20 =20 -const char *perf_tool_event__to_str(enum tool_pmu_event ev) +const char *tool_pmu__event_to_str(enum tool_pmu_event ev) { if (ev > TOOL_PMU__EVENT_NONE && ev < TOOL_PMU__EVENT_MAX) return tool_pmu__event_names[ev]; @@ -28,11 +28,11 @@ const char *perf_tool_event__to_str(enum tool_pmu_event= ev) return NULL; } =20 -enum tool_pmu_event perf_tool_event__from_str(const char *str) +enum tool_pmu_event tool_pmu__str_to_event(const char *str) { int i; =20 - perf_tool_event__for_each_event(i) { + tool_pmu__for_each_event(i) { if (!strcasecmp(str, tool_pmu__event_names[i])) return i; } @@ -44,7 +44,7 @@ static int tool_pmu__config_term(struct perf_event_attr *= attr, struct parse_events_error *err) { if (term->type_term =3D=3D PARSE_EVENTS__TERM_TYPE_USER) { - enum tool_pmu_event ev =3D perf_tool_event__from_str(term->config); + enum tool_pmu_event ev =3D tool_pmu__str_to_event(term->config); =20 if (ev =3D=3D TOOL_PMU__EVENT_NONE) goto err_out; @@ -91,10 +91,10 @@ int tool_pmu__for_each_event_cb(struct perf_pmu *pmu, v= oid *state, pmu_event_cal }; int i; =20 - perf_tool_event__for_each_event(i) { + tool_pmu__for_each_event(i) { int ret; =20 - info.name =3D perf_tool_event__to_str(i); + info.name =3D tool_pmu__event_to_str(i); info.alias =3D NULL; info.scale_unit =3D NULL; info.desc =3D NULL; @@ -130,7 +130,7 @@ enum tool_pmu_event evsel__tool_event(const struct evse= l *evsel) =20 const char *evsel__tool_pmu_event_name(const struct evsel *evsel) { - return perf_tool_event__to_str(evsel->core.attr.config); + return tool_pmu__event_to_str(evsel->core.attr.config); } =20 static bool read_until_char(struct io *io, char e) @@ -328,7 +328,7 @@ int evsel__tool_pmu_open(struct evsel *evsel, return err; } =20 -int evsel__read_tool(struct evsel *evsel, int cpu_map_idx, int thread) +int evsel__tool_pmu_read(struct evsel *evsel, int cpu_map_idx, int thread) { __u64 *start_time, cur_time, delta_start; int fd, err =3D 0; diff --git a/tools/perf/util/tool_pmu.h b/tools/perf/util/tool_pmu.h index b27a26133927..b156645206c4 100644 --- a/tools/perf/util/tool_pmu.h +++ b/tools/perf/util/tool_pmu.h @@ -17,7 +17,7 @@ enum tool_pmu_event { TOOL_PMU__EVENT_MAX, }; =20 -#define perf_tool_event__for_each_event(ev) \ +#define tool_pmu__for_each_event(ev) \ for ((ev) =3D TOOL_PMU__EVENT_DURATION_TIME; (ev) < TOOL_PMU__EVENT_MAX; = ev++) =20 static inline size_t tool_pmu__num_events(void) @@ -25,8 +25,8 @@ static inline size_t tool_pmu__num_events(void) return TOOL_PMU__EVENT_MAX - 1; } =20 -const char *perf_tool_event__to_str(enum tool_pmu_event ev); -enum tool_pmu_event perf_tool_event__from_str(const char *str); +const char *tool_pmu__event_to_str(enum tool_pmu_event ev); +enum tool_pmu_event tool_pmu__str_to_event(const char *str); int tool_pmu__config_terms(struct perf_event_attr *attr, struct parse_events_terms *terms, struct parse_events_error *err); @@ -44,7 +44,7 @@ int evsel__tool_pmu_prepare_open(struct evsel *evsel, int evsel__tool_pmu_open(struct evsel *evsel, struct perf_thread_map *threads, int start_cpu_map_idx, int end_cpu_map_idx); -int evsel__read_tool(struct evsel *evsel, int cpu_map_idx, int thread); +int evsel__tool_pmu_read(struct evsel *evsel, int cpu_map_idx, int thread); =20 struct perf_pmu *perf_pmus__tool_pmu(void); =20 --=20 2.46.1.824.gd892dcdcdd-goog