[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cjm6uOhffsiuVKk=2GBEUBZUyhNe-5QM5--tw3-X+UBJw@mail.gmail.com>
Date: Thu, 28 Mar 2024 22:46:00 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: weilin.wang@...el.com
Cc: Ian Rogers <irogers@...gle.com>, Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
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>
Subject: Re: [RFC PATCH v5 1/6] perf stat: Parse and find tpebs events when
parsing metrics to prepare for perf record sampling
On Tue, Mar 26, 2024 at 1:29 PM <weilin.wang@...el.com> wrote:
>
> From: Weilin Wang <weilin.wang@...el.com>
>
> Metrics that use tpebs values would use the :retire_latency keyword in
> formulas. We put all these events into a list and pass the list to perf
> record to collect their retire latency value.
>
> Signed-off-by: Weilin Wang <weilin.wang@...el.com>
> Reviewed-by: Ian Rogers <irogers@...gle.com>
> ---
[SNIP]
> @@ -681,8 +685,56 @@ static int metricgroup__build_event_string(struct strbuf *events,
> hashmap__for_each_entry(ctx->ids, cur, bkt) {
> const char *sep, *rsep, *id = cur->pkey;
> enum perf_tool_event ev;
> + /*
> + * Parse and search for event name with retire_latency modifier.
> + * If found, put event name into the tpebs_events list. This list
> + * of events will be passed to perf record for sampling to get
> + * their reitre_latency value.
> + * Search for ":R" in event name without "@". Search for the
> + * last "@R" in event name with "@".
What is the retire_latency modifier exactly?
Why do you search for :R and @R? What's the difference?
Why don't you search for "retire_latency"?
Thanks,
Namhyung
> + */
> + char *p = strstr(id, ":R");
> + char *p1 = strstr(id, "@R");
> +
> + if (p == NULL && p1) {
> + p = strstr(p1+1, "@R");
> + if (p == NULL)
> + p = p1;
> + p = p+1;
> + }
> +
> + if (p) {
> + char *name;
> + char *at;
> + struct tpebs_event *new_event = malloc(sizeof(struct tpebs_event));
>
> - pr_debug("found event %s\n", id);
> + if (!new_event)
> + return -ENOMEM;
> +
> + new_event->tpebs_name = strdup(id);
> + *p = '\0';
> + name = malloc(strlen(id) + 2);
> + if (!name)
> + return -ENOMEM;
> +
> + at = strchr(id, '@');
> + if (at != NULL) {
> + *at = '/';
> + at = strchr(id, '@');
> + *at = '/';
> + strcpy(name, id);
> + strcat(name, "p");
> + } else {
> + strcpy(name, id);
> + strcat(name, ":p");
> + }
> + new_event->name = name;
> + *tpebs_event_size += 1;
> + pr_debug("retire_latency required, tpebs_event_size=%lu, new_event=%s\n",
> + *tpebs_event_size, new_event->name);
> + list_add_tail(&new_event->nd, tpebs_events);
> + continue;
> + }
>
> /* Always move tool events outside of the group. */
> ev = perf_tool_event__from_str(id);
Powered by blists - more mailing lists