Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6872487rdb; Fri, 15 Dec 2023 10:26:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4QXej8F9L40xMfWhCmWAsHkyqJ9dvgUlo5INaRmM/5TNXKNj8IlXqVsUsg7fpEZqjC9dv X-Received: by 2002:a17:906:738b:b0:a1f:84ea:d8da with SMTP id f11-20020a170906738b00b00a1f84ead8damr6249036ejl.45.1702664819445; Fri, 15 Dec 2023 10:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702664819; cv=none; d=google.com; s=arc-20160816; b=I60OJHY73b7XTq0pwOQ8/9+qpxisi8Z6Ab4WY1jDkfzG8NdkL7ALnmLlWmY/x1c3iL cX/v68i5MlxJDDMUBUY7UhOCPO+ZRr5cLOICYmIIibANKFC2TPxdxA3QM2OV0/3CtU0a nNy8QK6YaXd/nXHlwmqCqTtMx0iWRGTOiU07iuS3B8OuyLxLpefy78BSX7kaNj/96Dyl CeRlFa/ZDL6BG3hldVPKRiNnPqQZ86W2rdp7YDJUaYQdkaf4kxTgPeMAlYuPHNSybG9E vnbB/+xONXLohypOaDGV18lh2X6qKv4n6oXTP49jrFGS4q7qMaEabCsGzgLthscRUyA6 n3Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OzD2mCx+r8+fwmqiQTXvNuYXURIlSIidayvhrGuuinE=; fh=AjsESTX3aTv3V2yM642aZSjUft/RUW3Vlphe0X5D9Xc=; b=bEbw7eVoZbTw6UX6lOmdu1YlJneVrLjPNAkQvSaeBUkoPaYwjMBTRte737y+AZCxBD MD3VyRjkIo502tOECp8mB9RH2lqq050bOmsWjSml11WSvfRFiYPb4bk3rbclBBCfrCXE UsjTasMo/+8d/DdHnNwaVabwiwqShVRl7w7nx/lvalTOGmeU5w652uamjsHRJwMFQP6M 3x0D9tAO7PcTiRHZTmMn3WmrkF7lDL37hXhox8QmnzNU/N2jG+3v5Q48aH0NJxXPKxUG IeC/nJdwT1PufSRI6mXhBH5UOSkbMSu5nEd4TZzds9qnMToMF2FCN1mlC4K4T5BZfKWA AClA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PyKhJrsi; spf=pass (google.com: domain of linux-kernel+bounces-1525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cd25-20020a170906b35900b00a1cfeab88casi7794949ejb.273.2023.12.15.10.26.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 10:26:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PyKhJrsi; spf=pass (google.com: domain of linux-kernel+bounces-1525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 361991F246AF for ; Fri, 15 Dec 2023 18:26:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8F3036B09; Fri, 15 Dec 2023 18:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PyKhJrsi" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2F3730130; Fri, 15 Dec 2023 18:26:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1178DC433C8; Fri, 15 Dec 2023 18:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702664809; bh=Uxm+Ld+49+IKhlPh3+Lb8jzwdKp8zlKxeU1rGQh+uUU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PyKhJrsiRdLEraV527cDOWhQbObcRjmIiegnkMgjULdaB9RzGb1HQkGRM+Lm7TaU3 Vd2dNC1zrVz/PzMIrXykUKke7H9RrYz9YFA1DNmU+m4fMQsq9jDV8li1Zq/wY8LeqC pvzYyEOUF+BF14YGXPZOhrG2XnTjzVq0Jl34g6rC9jHAvCep/zilYrFVY7VPybFNWI RONJmn9L9AtfqemjvL87HZiR8bGD4h7Wdsv3hQBgkUNU59nVuaDwDSr7lyfnueujQN gWhDD1rmFg8806u2BzFSf4ldI1i1/judHa1Kr6Ql5wAoFbF6mhK3IHPN4Zpxcyz5T+ VwduapuXXn36w== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5A65F403EF; Fri, 15 Dec 2023 15:26:46 -0300 (-03) Date: Fri, 15 Dec 2023 15:26:46 -0300 From: Arnaldo Carvalho de Melo To: "Liang, Kan" Cc: Mark Rutland , Ian Rogers , Namhyung Kim , 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 Message-ID: References: <20231208210855.407580-1-kan.liang@linux.intel.com> <07677ab2-c29b-499b-b473-f7535fb27a8c@linux.intel.com> <4658ca16-9749-434e-9296-3893aa2a34da@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4658ca16-9749-434e-9296-3893aa2a34da@linux.intel.com> X-Url: http://acmel.wordpress.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 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 --- 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