Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp827647lqs; Fri, 14 Jun 2024 06:57:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbKYG0n4sRjQyjSPuiMGk7TACUywDIyokbneRCU1zxDfUEVF3RaNF9MbpKqOkPjfA8sCzTy9bpc6/X1LcenHdr5vKJGEv/DhzaHeg+aw== X-Google-Smtp-Source: AGHT+IHLJbqC1mBdxSny7edKR/naHmeNeERYTyDhlLYfVpQbyTkv/EETOCxRFY9gIb/RhAzD4fi3 X-Received: by 2002:a05:6870:a91b:b0:254:ae17:c31e with SMTP id 586e51a60fabf-25842594e9dmr3128166fac.0.1718373450474; Fri, 14 Jun 2024 06:57:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718373450; cv=pass; d=google.com; s=arc-20160816; b=m760A1WKloDmEgfNFqoAjVz7KfMYVIz5KlhKnV3oY1dq1dRPHwWkqDq+3DWDilQG9S k6VakDjm+JZABFMzi//lMFy2uG6LBquehTPm2z8TLfzZbq7OEHIOzxPfB8W3IfWAJzPp ckToYYiA+mhYr4p+SkFrxeFGOCiMB67zcO5aSfb6Fm1LBppdAWtC5LFA2mHk465TIZ3C 0xLE9GsywznMnRWnpMKO14Lf7D0QAU6BA/wxEZJRY4lb3PfKq+cUxAVMIx5NPjMiVMff 5ydnJGpKmgppVqANXrX88OqUkx6n7ehVtldHmh1bHMZavQTwxqF94Jkp/4VxjgcSnSdU Jq9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=FZPLXCovA6tOx8EtxF21Zr80qSMU7lHz0lsliYvpAQ4=; fh=kckgzeoSVi0akHZX01/M7QtihyrB2hsBhINZDe9odec=; b=G3jD3Tr0bOjN3nKOq1oHr5vNLeRyxQ1k5EK9GSiB+3HCUPS8EU0tl0GENE1IIFZCpI /iYvkgFWyNiyjtisvjkWeO57aNjo3ZoehC/wCzlSRcPQzfs81W7G+M1hi0a49Q5wODED SnZi5f2MymKm0MXtsqHRL9udXdLdAaiV5wS4ysHa9qNsLpCHC2B3KbH3W26jO2UmUX1S msnBohzxTscLEHL5tIpe8n0P92BLUaTRaYhxMEmn2kF++jUJX/KvgbmWYZ1B6zdWv8xF Zfkhmc27vfB22e9sWBj4jIuKcWXwEJ8yOZmIlzVAUbHOpDEwC+HQF6HlBrJ2JKbJsYsy Cayg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-214962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fedd4f3d3fsi1446203a12.119.2024.06.14.06.57.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 06:57:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-214962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214962-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 22838B26749 for ; Fri, 14 Jun 2024 13:48:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D5B41642B; Fri, 14 Jun 2024 13:47:56 +0000 (UTC) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 54A0E9460; Fri, 14 Jun 2024 13:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718372875; cv=none; b=hh2Bd+9dr5IrY01aPF43nIlB5KnjEnfO5uhBDhYuw2K63naK9h8qC4SK87y0CMsFuUR7fljr9Y89hSE23hsGcAzvcKues8+70k9usO5x7nmL3TGY6ZNdLFNK3IGO+qz6lx+/3yCLo7QJDNIPaAwD9U8pVftMY+kihbG3FNN6/ZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718372875; c=relaxed/simple; bh=1aZksGUp8fLgwOWNQFUHylne4EqFbmCyrS3QmoLiH8g=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=RozzewteCF+/KazmlGGh0THZcA7lfQkpTRnJlQYuOjc12jG7UZUV2l4QBSjvs4a/9lEPgaXBsLYsYtiqbPBvEULwcr+VLWoha4GAeY01RtYqzmHMfhbfvk6eBmeUlYePLFOX2vi3lwuntz7oGa4o5VsIFRKHGAzNVizcGPqq0UY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1f70c457823so18282125ad.3; Fri, 14 Jun 2024 06:47:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718372873; x=1718977673; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FZPLXCovA6tOx8EtxF21Zr80qSMU7lHz0lsliYvpAQ4=; b=IfAcvIQi4jYHMKctQtoR9O+3zGM5oiyhus+mrGWf53vFLXddc3SShIos56Ak4t716E dYTQ3Xi+CPt88Ig9NKevroEhf3DRUJO2taXo8+PnhBiUh2teyQPpZDszRVqJN29ydtwP p53Fsa9Iu4ZO7E09hHscZPUA6H1JVjWMKdvHvZS7V+cVihkpJNZTBLjmhoyKLMqnOhDq Gsb79m//yAjACrGNR7yhgWV3+9ayYyLCLWmMQSB2S2GdKJvDOEWSmg7YMVDzucQOzbhJ a7I/udXyLvWEOA61o92fBB61XI2pF6VGhug8SO20v+rtiubkL2KCceTLkM2zPItMgTZv fhoQ== X-Forwarded-Encrypted: i=1; AJvYcCXRyaYisizilA5uff/hkx15cdESbAXHLcTSJLIR3ZuO/RTbrsEKr/n/dcHisBqRSXRIkdJraG+hpi69mbbZ8DvbV22k3Uk3lfqJgCdw X-Gm-Message-State: AOJu0Yy6KPAQ62LBiomGE7j47o/XhAU7rqDiGJli64zpuhwZBCWjpvnA bdQdhuCyhCsMlSq28aFMfbspQhW4QqBeraNtaZc0192s7FDrYO1avBhcPJ7sHRiP2iphA+hjebD EI/TFW8TOcR35ILIUDr1HeOlrWJY= X-Received: by 2002:a17:90a:b00f:b0:2c2:d813:bffa with SMTP id 98e67ed59e1d1-2c4dbd431b5mr2778121a91.43.1718372873526; Fri, 14 Jun 2024 06:47:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240614073517.94974-1-sieberf@amazon.com> In-Reply-To: <20240614073517.94974-1-sieberf@amazon.com> From: Namhyung Kim Date: Fri, 14 Jun 2024 06:47:42 -0700 Message-ID: Subject: Re: [PATCH] perf: sched map skips redundant lines with cpu filters To: Fernand Sieber Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Madadi Vineeth Reddy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, On Fri, Jun 14, 2024 at 12:49=E2=80=AFAM Fernand Sieber wrote: > > perf sched map supports cpu filter. > However, even with cpu filters active, any context switch currently > corresponds to a separate line. > As result, context switches on irrelevant cpus result to redundant lines, > which makes the output particlularly difficult to read on wide > architectures. > > Fix it by skipping printing for irrelevant CPUs. > > Example snippet of output before fix: > > *B0 1.461147 secs > B0 > B0 > B0 > *G0 1.517139 secs > > After fix: > > *B0 1.461147 secs > *G0 1.517139 secs > > Signed-off-by: Fernand Sieber > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Arnaldo Carvalho de Melo > Cc: Alexander Shishkin Acked-by: Namhyung Kim Thanks, Namhyung > --- > tools/perf/builtin-sched.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c > index 7422c930abaf..aa59f763ca46 100644 > --- a/tools/perf/builtin-sched.c > +++ b/tools/perf/builtin-sched.c > @@ -1594,8 +1594,6 @@ static int map_switch_event(struct perf_sched *sche= d, struct evsel *evsel, > > sched->curr_thread[this_cpu.cpu] =3D thread__get(sched_in); > > - printf(" "); > - > new_shortname =3D 0; > if (!tr->shortname[0]) { > if (!strcmp(thread__comm_str(sched_in), "swapper")) { > @@ -1622,6 +1620,11 @@ static int map_switch_event(struct perf_sched *sch= ed, struct evsel *evsel, > new_shortname =3D 1; > } > > + if (sched->map.cpus && !perf_cpu_map__has(sched->map.cpus, this_c= pu)) > + goto out; > + > + printf(" "); > + > for (i =3D 0; i < cpus_nr; i++) { > struct perf_cpu cpu =3D { > .cpu =3D sched->map.comp ? sched->map.comp_cpus[i= ].cpu : i, > @@ -1656,9 +1659,6 @@ static int map_switch_event(struct perf_sched *sche= d, struct evsel *evsel, > color_fprintf(stdout, color, " "); > } > > - if (sched->map.cpus && !perf_cpu_map__has(sched->map.cpus, this_c= pu)) > - goto out; > - > timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestam= p)); > color_fprintf(stdout, color, " %12s secs ", stimestamp); > if (new_shortname || tr->comm_changed || (verbose > 0 && thread__= tid(sched_in))) { > @@ -1675,9 +1675,9 @@ static int map_switch_event(struct perf_sched *sche= d, struct evsel *evsel, > if (sched->map.comp && new_cpu) > color_fprintf(stdout, color, " (CPU %d)", this_cpu); > > -out: > color_fprintf(stdout, color, "\n"); > > +out: > thread__put(sched_in); > > return 0; > -- > 2.40.1 > >