From patchwork Fri Jul 12 18:11:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732161 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 BB271C3DA45 for ; Fri, 12 Jul 2024 18:19:59 +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=DzgUQ0L67yHK9ZgYOmZnLIT3MZDT9EVRhOxDmj12OGQ=; b=q19mpGKuAXpV66y1CPnF7k3rg4 +6Y/nxPUmkn71FzdAN0bqpz4vqQlpVSLO66ZIrvxxJjQhCkbnvQ/FjAPA/1jEPX4L6KrmWm60cwHX HzOH7EVCY3bJFpnCN+A0AZuGu0HHxYxFPd++fCFToMVbeD/S4cYVahK88bup5dpiJBMYo1+8+dFmW e0CJI3XhSEGwmuujTVdQV0T9S8hOVY93o4wIHPhMgepyee2a02nNiEhlubyCmcs1Ew8EZPrMpP1wD cN5Ou8JpNL8TJH4NF1LEavGhnfq+JKJNALipNx4Z+6ZkFXBIEqmavkPRkNVgrDDGRb0yh6jj39yan 8CU4l99Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKs1-00000000yVV-39TS; Fri, 12 Jul 2024 18:19:49 +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 1sSKlb-00000000vhA-2WDr for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:13:13 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-65ef46e8451so9274017b3.0 for ; Fri, 12 Jul 2024 11:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807990; x=1721412790; 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=DzgUQ0L67yHK9ZgYOmZnLIT3MZDT9EVRhOxDmj12OGQ=; b=L7s1djB+ROYaF4TF54/ci0vl8o1Cjw6steOG1vm9nICt2IXPvG7Iid9cktDgNPPGBS GAsfITSuhq/5KcVqEXqmhw7hB9tz/vUSWU8Yg+85imf+CKB+uidIBV8ACao6GcWrDSao TV9C4QQfMS3+1IRy0xQ6bJy/jeEkAHskIoKaSSlJU+ye1EjB0mJMx3pAc5vegtBpz1mQ MOPsMhpwZS5jjCha8iGAY5t4ccWS70iETmUVcqFK2LX8gtZkPmH9gMmGkGGkqfhIAmMe 3ffD96Dq6yf8P2UYuW9z6MsZo6Y8CQfaNmEZ9MzTr+yrIXrQAtr8QU1zqwUXTjL5uEyx Ui5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807990; x=1721412790; 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=DzgUQ0L67yHK9ZgYOmZnLIT3MZDT9EVRhOxDmj12OGQ=; b=sMmYw+YXOIyhS3I4cXZBk+ZN+EFjyOLDtb19L1jzHFqEK9hZBvJu6owHwuZDgw//ka dsKOuT48n+7Vj7SQ5I6VwPCFCzmWargrgNtQivyp+SkybbeOBcwTJrqMaKfWeFic3/lu 2Q8v9kPiewehC/qkEBnfwvdJcvxxsbdg6vrp5n2GOtUnBUEPAqogFGkhK103qp+Pd2cV mXwFvS46JWWbTnxmsMmeucGP3qBMv55eNS1GwpJA9ReIXuuFu4yBP3cp9bsLQCKwXcmy ArrD6pbr2OW8oGIujOVznLp9mhFG/FPh2vuWBCa6xnx2uN5PSaJyjKN5/yOURceV5W6n bBAw== X-Forwarded-Encrypted: i=1; AJvYcCW05HRnGDSu44kKoEYs4EGAQJO2wdACWBtxfUDgXXRrq+ze6r23TeyzxqUycU80ur+AvYgbdtdBsK72JBqujfjXzxTXr1criIN/WXPk1fzE7MrzP4s= X-Gm-Message-State: AOJu0YxpJx6V8zxQrRSnXZ/5sA7rF2ufs8TW2jUCCDGViFpN2A3trEk/ nte93zyaah/cCvrbzu/LcOStR3WLAq8jfWbvv2G2A9g4H4N0vcD/Bs9ACAu0qLWsrY3CHMT3XOB pj0L8Rg== X-Google-Smtp-Source: AGHT+IHiAKXzsCdcEZM+MFSDfgz1r4L7ozGy4B9BF+4puH4qqiiY89mJfDURywhS/WGVSxBcH3QuZhcuBDvg X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:6902:188a:b0:e03:2217:3c8f with SMTP id 3f1490d57ef6-e041b035055mr23746276.2.1720807990114; Fri, 12 Jul 2024 11:13:10 -0700 (PDT) Date: Fri, 12 Jul 2024 11:11:08 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-28-irogers@google.com> Mime-Version: 1.0 References: <20240712181108.475336-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.993.g49e7a77208-goog Subject: [PATCH v5 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-20240712_111311_712393_EAD6A7E1 X-CRM114-Status: GOOD ( 14.73 ) 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 --- 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;