All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Liang, Kan" <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Ian Rogers <irogers@google.com>,
	Namhyung Kim <namhyung@kernel.org>,
	maz@kernel.org, marcan@marcan.st, linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf top: Use evsel's cpus to replace user_requested_cpus
Date: Fri, 15 Dec 2023 15:26:46 -0300	[thread overview]
Message-ID: <ZXyaZjwrpy6toGf6@kernel.org> (raw)
In-Reply-To: <4658ca16-9749-434e-9296-3893aa2a34da@linux.intel.com>

Em Fri, Dec 15, 2023 at 12:59:22PM -0500, Liang, Kan escreveu:
> On 2023-12-15 10:36 a.m., Arnaldo Carvalho de Melo wrote:
> 
> #perf report --header-only | grep event
> # event : name = cpu_atom/cycles:P/, , id = { 7360, 7361, 7362, 7363,
> 7364, 7365, 7366, 7367, 7368, 7369 }, type = 0 (PERF_TYPE_HARDWARE),
> size = 136, config = 0xa00000000, { sample_period, sample_freq } = 3000,
> sample_type = IP|TID|TIME|PERIOD|IDENTIFIER, read_format = ID|LOST,
> disabled = 1, inherit = 1, freq = 1, enable_on_exec = 1, precise_ip = 3,
> sample_id_all = 1
> # event : name = cpu_core/cycles:P/, , id = { 7370, 7371, 7372, 7373,
> 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381 }, type = 0
> (PERF_TYPE_HARDWARE), size = 136, config = 0x400000000, { sample_period,
> sample_freq } = 3000, sample_type = IP|TID|TIME|PERIOD|IDENTIFIER,
> read_format = ID|LOST, disabled = 1, inherit = 1, freq = 1,
> enable_on_exec = 1, precise_ip = 3, sample_id_all = 1
> 
> I think we should move all the modifiers after the "/". The below patch
> can fix it.
> 
> https://lore.kernel.org/lkml/20231215175455.1300261-1-kan.liang@linux.intel.com/

Right, I implemented it in a slightly different way, but end result
should be the same:

From 5dd1b7ab1ba69ebb8e070923dcc214b7b489ffc2 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Fri, 15 Dec 2023 15:23:30 -0300
Subject: [PATCH 1/1] perf evlist: Move event attributes to after the / when
 uniquefying using the PMU name

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 6f0892803c2249af..3a9505c99490b372 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -2522,7 +2522,7 @@ void evlist__warn_user_requested_cpus(struct evlist *evlist, const char *cpu_lis
 void evlist__uniquify_name(struct evlist *evlist)
 {
 	struct evsel *pos;
-	char *new_name;
+	char *new_name, *attributes;
 	int ret;
 
 	if (perf_pmus__num_core_pmus() == 1)
@@ -2535,8 +2535,16 @@ void evlist__uniquify_name(struct evlist *evlist)
 		if (strchr(pos->name, '/'))
 			continue;
 
-		ret = asprintf(&new_name, "%s/%s/",
-			       pos->pmu_name, pos->name);
+		attributes = strchr(pos->name, ':');
+		if (attributes)
+			*attributes = '\0';
+
+		ret = asprintf(&new_name, "%s/%s/%s",
+			       pos->pmu_name, pos->name, attributes ? attributes + 1 : "");
+
+		if (attributes)
+			*attributes = ':';
+
 		if (ret) {
 			free(pos->name);
 			pos->name = new_name;
-- 
2.43.0


  reply	other threads:[~2023-12-15 18:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 21:08 [PATCH] perf top: Use evsel's cpus to replace user_requested_cpus kan.liang
2023-12-11 21:13 ` Arnaldo Carvalho de Melo
2023-12-12 15:56   ` Liang, Kan
2023-12-12 16:58     ` Arnaldo Carvalho de Melo
2023-12-12 17:23     ` Namhyung Kim
2023-12-12 18:00       ` Ian Rogers
2023-12-12 18:31         ` Mark Rutland
2023-12-12 18:49           ` Namhyung Kim
2023-12-12 19:22             ` Liang, Kan
2023-12-13 12:05               ` Mark Rutland
2023-12-12 19:26             ` Ian Rogers
2023-12-15 15:36           ` Arnaldo Carvalho de Melo
2023-12-15 16:51             ` Mark Rutland
2023-12-15 17:49               ` Arnaldo Carvalho de Melo
2024-01-05 12:31                 ` Mark Rutland
2023-12-15 17:59             ` Liang, Kan
2023-12-15 18:26               ` Arnaldo Carvalho de Melo [this message]
2023-12-15 18:53                 ` Liang, Kan
2023-12-18 20:23                   ` Arnaldo Carvalho de Melo
2023-12-18 21:07                     ` Liang, Kan
2023-12-12  0:02 ` Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZXyaZjwrpy6toGf6@kernel.org \
    --to=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.