Message ID | 20240213075256.1983638-2-namhyung@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-63062-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp383825dyb; Mon, 12 Feb 2024 23:54:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVcVHoFnTg4YThGbEYF8ZEYA4n1wNkT1NaUo9ipR8TsQyRaT60ZbhKRJ2qghIvFcUT3bFOLoYVwDPEEGo6b+oOwbVpKpg== X-Google-Smtp-Source: AGHT+IHpI7bnbLGfVCgnDj18mfIGauXsEIBVHW7OLuQBunrrdTd7fdOo8Xx30HWj27KNpPQJbQGO X-Received: by 2002:aa7:d1ce:0:b0:561:9d6:aa6 with SMTP id g14-20020aa7d1ce000000b0056109d60aa6mr5414894edp.41.1707810852713; Mon, 12 Feb 2024 23:54:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707810852; cv=pass; d=google.com; s=arc-20160816; b=gbrC1IYZGEbcSGp6PtIV311EqEAZ/24sthGe6Y3dHKdBoOBB0lvkhOyWbaOqQhVubN 4Y6F0NVcT+vZN+q8dG6cvk5oUZCV0uIWri4Ouk8ichmenr3RLGvXjnqtxWEbPC7qTc5H Jvs9uWmi761IWilw2DuJDWDGc+lEHFiANQnPiTjyp8waqognFKNjG6hoDKgFmE6ZKM1L 7F2OJo30NHMOVAnVUk0P+0Ia/HLLrDRrHy02e2/P8g07t2BDjqV+i7UOiPleixBuq1KB tLV3ttkAEsNkMpeSycrrOASbuGyWdsWflLyf9EHZcTqFfsMamgG8bgV4bHzj0LP4IxxB L2og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jShWWTU9NHNLgi54yn4/SkseYjEWNIGNq0s5Njz5XRI=; fh=Tjt/cM9aDyYFrZCQEqFwPh8SBvAidaS8Wu0CcEibpS4=; b=C+Movi/BqmyaCqkQ4d1Qh6ImLYmDLBm0aMJ0Uqhauh7C68TnOWAXR+PgPdwXrT5M/p pyXkfxJziyrxvIcv+bViXlIkx+kdQj+t3rvGmuMQxxbbK170pMS4FikI0W4tzHqDSGLA VkEL12Z6IznWdP1eQzRP2YuVMqf7+7y/0baZK2oD+9EbOs92S2Dac+p4mYNdQpqA+G8F jbQKcD0KiNAaQ8YzQzY/n2S8a7uuK9RLnMcndUtwu+J1yb/Hl3lDUNOzExrWOqZfsNih 7qI5mhCwblbsCOQS+7AnMnRKQjloVpocqmN0rhlbLFqIfXbOkvKA3k2eicNp2VpaWmau fgHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g3dpFVKv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63062-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63062-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVwhhoyHHEUbVdFH/MRe10TYkfI8OPK6EF76/Vs8Az19LkSP63t9gBt4ryKYmZmd7tTHAla2dwHq+jbA/3WYsH2lCFEKA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c9-20020a05640227c900b0056188e1a9bbsi2723814ede.508.2024.02.12.23.54.12 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 23:54:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63062-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g3dpFVKv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63062-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63062-ouuuleilei=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 37B431F22966 for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 07:54:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E30021A06; Tue, 13 Feb 2024 07:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g3dpFVKv" 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 5FD7418036; Tue, 13 Feb 2024 07:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707810778; cv=none; b=DhHZhx+UVj2EAZ8xun6RN3/9ThdYbA8ai8zpr7fnfdPEZR3/9/PKCxVN5NFMXrWp6T6t2wrpjXpv0uebeUKwEq4eVHUAGQulhraa9IaE32jrOpBLwZ3qwnJyqWu9JFCqrVoL/aXw/w/Gc+9G4X3NkgFI5xC1fyaYdZWkhEAoE5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707810778; c=relaxed/simple; bh=sOy6KlficwKF5vE8HVBwVLDj0OcsjYyU8khFYs9JUiQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VqquY+QP88Dy9pqzJKwtNYyF7GGfI8hvQ0N/djndXBbxVvFDmmXdSTkHbM8FeaUd7vbgDDPR7xVJ2GAu132C1XNy8NXaCtiSfnJhejIPzGNIjEk4dNjeZ/mrfWLDNR39gVl1Th4oJRbPCS8hBjFe6ob25bkH3H+qMx3ERhoT4F4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g3dpFVKv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F3CDC43390; Tue, 13 Feb 2024 07:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707810777; bh=sOy6KlficwKF5vE8HVBwVLDj0OcsjYyU8khFYs9JUiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3dpFVKvINO5IweleyEFN/hEmQOIAzXGvkh7OnKH2x8GDDheWS9D/+vK4Tz0PXgt+ fAFAxgwkzfqpIf2tuIcZLaSD2ahUrfcv8rIBEcwASBzkD2Q6Rrx/BUT9iYtyJ4HMw1 9L/J2j4PzZ3x+w5K7oaKu8seXAVWfd9v64bwWuPOFB5h1nWiaMC5AJ80kqDUypo1Mi AS7YUtMaNMgvVxo7jjWMftJIsAKr+XntKtiddO+Bhk2ON66cpePHJ+GXAxTBPaRCno KZoz3IuA8qs5Xfk8SAhVQznCVRmoDlUg5TJ8BoSMLHQBmzLOLoWOrruiL36CABrxnQ +XgJBIW8OIFLw== From: Namhyung Kim <namhyung@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org>, Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org>, Adrian Hunter <adrian.hunter@intel.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>, LKML <linux-kernel@vger.kernel.org>, linux-perf-users@vger.kernel.org Subject: [PATCH 1/4] libperf evlist: Update group info in perf_evlist__remove() Date: Mon, 12 Feb 2024 23:52:53 -0800 Message-ID: <20240213075256.1983638-2-namhyung@kernel.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240213075256.1983638-1-namhyung@kernel.org> References: <20240213075256.1983638-1-namhyung@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790769472544142569 X-GMAIL-MSGID: 1790769472544142569 |
Series |
perf report: Omit dummy events in the output (v1)
|
|
Commit Message
Namhyung Kim
Feb. 13, 2024, 7:52 a.m. UTC
When an event in a group is removed, it should update the group status
including the pointer to leader and number of member events.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/perf/evlist.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
Comments
On Mon, Feb 12, 2024 at 11:52 PM Namhyung Kim <namhyung@kernel.org> wrote: > > When an event in a group is removed, it should update the group status > including the pointer to leader and number of member events. > > Signed-off-by: Namhyung Kim <namhyung@kernel.org> Should we worry about evlist's all_cpus that could also be stale now? Thanks, Ian > --- > tools/lib/perf/evlist.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c > index 058e3ff10f9b..befdb062fa1d 100644 > --- a/tools/lib/perf/evlist.c > +++ b/tools/lib/perf/evlist.c > @@ -102,8 +102,29 @@ void perf_evlist__add(struct perf_evlist *evlist, > void perf_evlist__remove(struct perf_evlist *evlist, > struct perf_evsel *evsel) > { > + struct perf_evsel *leader = evsel->leader; > + > list_del_init(&evsel->node); > evlist->nr_entries -= 1; > + > + /* return stand-alone event */ > + if (leader == evsel && leader->nr_members < 2) > + return; > + > + if (leader == evsel) { > + struct perf_evsel *member; > + > + /* select the next event as a new leader */ > + leader = member = perf_evlist__next(evlist, evsel); > + > + /* update members to see the new leader */ > + while (member && member->leader == evsel) { > + member->leader = leader; > + member = perf_evlist__next(evlist, member); > + } > + } > + > + leader->nr_members = evsel->leader->nr_members - 1; > } > > struct perf_evlist *perf_evlist__new(void) > -- > 2.43.0.687.g38aa6559b0-goog >
On Wed, Feb 14, 2024 at 3:50 PM Ian Rogers <irogers@google.com> wrote: > > On Mon, Feb 12, 2024 at 11:52 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > When an event in a group is removed, it should update the group status > > including the pointer to leader and number of member events. > > > > Signed-off-by: Namhyung Kim <namhyung@kernel.org> > > Should we worry about evlist's all_cpus that could also be stale now? Hmm.. right. I will refresh the cpu list after removal. Thanks, Namhyung
diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c index 058e3ff10f9b..befdb062fa1d 100644 --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -102,8 +102,29 @@ void perf_evlist__add(struct perf_evlist *evlist, void perf_evlist__remove(struct perf_evlist *evlist, struct perf_evsel *evsel) { + struct perf_evsel *leader = evsel->leader; + list_del_init(&evsel->node); evlist->nr_entries -= 1; + + /* return stand-alone event */ + if (leader == evsel && leader->nr_members < 2) + return; + + if (leader == evsel) { + struct perf_evsel *member; + + /* select the next event as a new leader */ + leader = member = perf_evlist__next(evlist, evsel); + + /* update members to see the new leader */ + while (member && member->leader == evsel) { + member->leader = leader; + member = perf_evlist__next(evlist, member); + } + } + + leader->nr_members = evsel->leader->nr_members - 1; } struct perf_evlist *perf_evlist__new(void)