From patchwork Thu Jul 18 01:00:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13735918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9FA38C3DA5D for ; Thu, 18 Jul 2024 01:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VI+1UrmSH+U4tsTCU1WpnUiPEx/6DVcJnUZK6PtxySs=; b=AYWhstxRyB8j6m+bmA95rMtcK7 sAwnpIyd1pbOt92bGu0qECAQ7+YNxIvb4uNkXwMfIkgpToMLljzXkxVbFA2+HYoPnazGaCWNC78e6 Vmymv1Ju3FGcLOSmp+MDlNWL8L2bj9ziys9mw55HaMJG61/mBKHVOWuMjbXlQ3b42+RY9mK/jCONX cvU9hi/CkdpEGLKqTSd7oPHgO3evLKiEcRxllLZOz4UR37+8ijpIIkz1PTZNo1zudVh0W99ooWdw/ qp+l5R1grMh9OcYqwY9g9flULKpZUddtB0Sqh/Pk4hMOahJQnFCxFRXxYeoGDBBKyWyiwVC6CkS5T RnygL0qA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFe8-0000000FMj5-39SM; Thu, 18 Jul 2024 01:09:24 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFWd-0000000FJvZ-40RK for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 01:01:41 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-64b70c4a269so6457897b3.1 for ; Wed, 17 Jul 2024 18:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264499; x=1721869299; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=VI+1UrmSH+U4tsTCU1WpnUiPEx/6DVcJnUZK6PtxySs=; b=qyeay/swvIXtmqvVlfv7QgI2g38s2q+oTXfsDyKzTaQBUDh7K9dleHPSmjCRDvk0KC 7TAdeT75yqwM0mFo+W+/xXRcGDXurd15uitZseHidR2IfP/mahTYfEaIApQVghuhRvsp h0z2dOsc2Uv4IceWY9RziqmpcRgR5UJ5uZxzs9rvTIJT+cWT1LimCLorT1+hXn0gMkAM LEQYlLVB+dPsE5I/9jm0JwyIW4E62nqGs9mwW/ovap5f0DB1ddCa8Al09cO/PNXJhqiR 0o9V3NYSZdGQjfYiZcJAok9L88woUn/0E0M/m2kv2cNHF8u6uKnNXUyPVAXSyl9ifRRv /t4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264499; x=1721869299; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VI+1UrmSH+U4tsTCU1WpnUiPEx/6DVcJnUZK6PtxySs=; b=s/33XfvyzCP+nz6YckFTeH37EA7tdBn9h/LCzyUzNtL5tv5vpYBXDoBhxewrJYmYRP 6JVb+8e9WuAjJyrOMy8gAWheJvictSBVbJqlkj0PQRR0x8mdVb7AYpl4BIphcZtSp2G8 XstRA55Xbrr7aIdRFsexba5qw1ky78C+dO0Q8IGSuoGouFzZdVn/6XZe2f4VqWBIbRW9 IuJ87pRNpgWAUYDssW0xc0sfzNk5f0ffmbw8i4egip4OT1iBHzeoJHDvqVACxbWHOH3e cMtNWriag79Zczia9pfaL9F0L+nsDK4r06bR/qCQGUec4Mp/w+onPPQbuiYRWrCBckNT oo9w== X-Forwarded-Encrypted: i=1; AJvYcCXGji2dDbz3Vy0SFCI8QufISrXvWv+9uqsxGipGaCUYQBG3BchRRPJQnCxiXG35JoSwSHY0hMDIrqlrwqOFsHxAaTyFspM0RFppjbp12VF4XzkIdes= X-Gm-Message-State: AOJu0YwNAVqkZTyYfldlXJyXTWUmEAHVBI8gkVKnTrEa5TbB49rOdi8+ c8CYYK6/q0cuGaCQTVIjMTVFvbs/It3oy84ogp2FHfDPJ6iIaywOsNZh8a6JLARKHOsxnbnXoUo 55xxSEw== X-Google-Smtp-Source: AGHT+IGQt5ri8LAL7TX8J0R4Z6KxrCn64uDLn1sYG1dmmUfG8en4e1ioo3g5nWqMwIk/M1O4Qs9bCX+5dLdq X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a05:690c:110:b0:65c:1db1:9235 with SMTP id 00721157ae682-666005395bbmr263907b3.0.1721264498698; Wed, 17 Jul 2024 18:01:38 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:23 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-28-irogers@google.com> Mime-Version: 1.0 References: <20240718010023.1495687-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Subject: [PATCH v6 27/27] perf session: Constify tool From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Nick Terrell , Nick Desaulniers , Oliver Upton , Anshuman Khandual , Song Liu , Ilkka Koskinen , Athira Rajeev , Huacai Chen , Yanteng Si , Sun Haiyong , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240717_180140_072954_42C94EE9 X-CRM114-Status: GOOD ( 13.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make tool const now that all uses are const and perf_tool__fill_defaults won't be used. The aim is to better capture that sessions don't mutate tools. Signed-off-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/util/session.c | 6 +++--- tools/perf/util/session.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index ad5da61d2330..0c7cc092887d 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1765,7 +1765,7 @@ static int __perf_session__process_decomp_events(struct perf_session *session); static int __perf_session__process_pipe_events(struct perf_session *session) { struct ordered_events *oe = &session->ordered_events; - struct perf_tool *tool = session->tool; + const struct perf_tool *tool = session->tool; struct ui_progress prog; union perf_event *event; uint32_t size, cur_size = 0; @@ -2195,7 +2195,7 @@ static int __perf_session__process_events(struct perf_session *session) .in_place_update = session->data->in_place_update, }; struct ordered_events *oe = &session->ordered_events; - struct perf_tool *tool = session->tool; + const struct perf_tool *tool = session->tool; struct ui_progress prog; int err; @@ -2245,7 +2245,7 @@ static int __perf_session__process_events(struct perf_session *session) static int __perf_session__process_dir_events(struct perf_session *session) { struct perf_data *data = session->data; - struct perf_tool *tool = session->tool; + const struct perf_tool *tool = session->tool; int i, ret, readers, nr_readers; struct ui_progress prog; u64 total_size = perf_data__size(session->data); diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 7f69baeae7fb..7c8dd6956330 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h @@ -43,7 +43,7 @@ struct perf_session { u64 one_mmap_offset; struct ordered_events ordered_events; struct perf_data *data; - struct perf_tool *tool; + const struct perf_tool *tool; u64 bytes_transferred; u64 bytes_compressed; struct zstd_data zstd_data;