[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <db0135bb-6548-07f8-2707-ec13a7aae8b6@linux.intel.com>
Date: Tue, 26 Sep 2023 12:35:09 -0400
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: weilin.wang@...el.com, Ian Rogers <irogers@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>
Cc: linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
Perry Taylor <perry.taylor@...el.com>,
Samantha Alt <samantha.alt@...el.com>,
Caleb Biggers <caleb.biggers@...el.com>,
Mark Rutland <mark.rutland@....com>
Subject: Re: [RFC PATCH 22/25] perf stat: Add TSC support in hardware-grouping
On 2023-09-25 2:18 a.m., weilin.wang@...el.com wrote:
> From: Weilin Wang <weilin.wang@...el.com>
>
> Add TSC check and create new event for it the same way as how we handle
> topdown-* for now since it is not listed in an event json file either. Need
> TSC to support TopdownL4-L5.
>
> Signed-off-by: Weilin Wang <weilin.wang@...el.com>
> ---
> tools/perf/util/metricgroup.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index d10f6afb0..07a82fa21 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -321,6 +321,14 @@ static int setup_metric_events(const char *pmu, struct hashmap *ids,
> }
> }
> if (matched_events < ids_size) {
> + struct hashmap_entry *cur;
> + size_t bkt;
> +
> + hashmap__for_each_entry(ids, cur, bkt) {
> + const char *id = cur->pkey;
> +
> + pr_debug("Need event %s\n", id);
> + }
Is it just for the debug purpose?
If so, please only traverse the hashmap in debug.
> free(metric_events);
> return -EINVAL;
> }
> @@ -2106,11 +2114,16 @@ static int hw_aware_build_grouping(struct expr_parse_ctx *ctx,
> #define RETURN_IF_NON_ZERO(x) do { if (x) return x; } while (0)
> hashmap__for_each_entry(ctx->ids, cur, bkt) {
> const char *id = cur->pkey;
> - const char *special_pattern = "topdown-";
> + const char *pattern1 = "topdown-";
> + const char *pattern2 = "TSC";
>
> pr_debug("found event %s\n", id);
> - if (!strncmp(id, special_pattern, strlen(special_pattern))) {
> + if (!strncmp(id, pattern1, strlen(pattern1)) ||
> + !strncmp(id, pattern2, strlen(pattern2))) {
I guess there may be more patterns later. It's better to add a dedicated
function to the check.
Thanks,
Kan
> struct metricgroup__event_info *event;
> + /* topdown-* and TSC use dedicated registers, set as free
> + * counter here for grouping
> + */
> event = event_info__new(id, "default_core", "0", false,
> /*free_counter=*/true);
> if (!event) {
> @@ -2602,8 +2615,10 @@ int metricgroup__parse_groups(struct evlist *perf_evlist,
> ret = hw_aware_parse_groups(perf_evlist, pmu, str,
> metric_no_threshold, user_requested_cpu_list, system_wide,
> /*fake_pmu=*/NULL, metric_events, table);
> - if (!ret)
> + if (!ret) {
> + pr_info("Hardware aware grouping completed\n");
> return 0;
> + }
> }
>
> return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_merge,
Powered by blists - more mailing lists