From patchwork Mon Aug 12 20:47:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761044 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 6E02DC52D7C for ; Mon, 12 Aug 2024 21:03:43 +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=4wczZj/G5PmxA13DCbaUvl0QUyy3P1R91oRL5UB3198=; b=njJL8slsPdCmnDHdhK7BscgRV3 Hi4pjmWyXrDcjn3cuwQA5Z3sWJy6/dWc3sX0XA2i9242GGV24FFKUBj+wnrHnqtN70pm4FasqVbNo lX55EcQ4bpnotdc6MC8CuxvvvdVrLu48QaFlBAxcM20W7DJxV5W4slLJMZ3qmTFkK3t9OmU+AOt95 bGuhbhZNU15KXr9Vkpaiygr+sHXQ9abq4z2gJkW+v52yxmIj/ZmnLFnzjK6URRsyStr9oGEBBt2S1 OfVd9q9HDSpN3ekXff2rND6PrHBW8Zua3l5xGiTXIxNccwMaZ62ukFvPQzoCg4IGoy2YsC5Gx29fz Atwpo+dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdcCR-00000001Z2Q-2JDB; Mon, 12 Aug 2024 21:03:31 +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 1sdbxr-00000001UsI-3kBm for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:48:29 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-665a6dd38c8so103051447b3.1 for ; Mon, 12 Aug 2024 13:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495706; x=1724100506; 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=4wczZj/G5PmxA13DCbaUvl0QUyy3P1R91oRL5UB3198=; b=hSwolQ0vu/gQgtw4dxlHLU58yly+DwEKjHZKnD0xBobPUVqxgnl9IIrTTYWQxmOwXG IMzVOMjGZhVWKLkqGzomioZeRvzZ8R3GTVDUGSippSd0LRLpdlGsQOjf8m55tU9pq5CP K/4t5x1er8xvtnMUbCEl9SR06JjXDx/2nzgZUXNlpZ0bwdZUKPB6G7j9fjQxsTSyY+Ru vaM0semJKOy7KMoGub+dGrSD+IhNjCx5FmAyM/fGAqoVZk79lWo7Xr2jfLgpLd+yudn7 pvCbV+8LsybZgg4C5eQd8gg+wFwf9r597GsdReAsHxE62RnTSxb2x5l4UqxPjS7Wrq3W kQXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495706; x=1724100506; 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=4wczZj/G5PmxA13DCbaUvl0QUyy3P1R91oRL5UB3198=; b=lpdcX/QzHA6dnG2/pBswbfmE3uO0iwW6VyosqUqO8xVNSzHf9OEgZcGHNttEldlQ0J ARc6L3OSN4oZ+nuJwCUIVPVIooKXno0JMztOT+UJvDYbdOY+A+2Ala7G69IHlW8T7sOL AncUHQrRFrqvkaOV6nM3B80rCJ1qG3K85F0FuhXPkRTJwtbFcNlFusU11jIHaAULvvq+ sNBaj4pLwwuCKV+0JeploJVpjNveeiy98hT6pOnfWg8I4TRB4VNwN8kFoaEKU/Vrirua 9sQ9YV4Ls7MmP24Wh5YKWEVcc89VWi0dZqm8AfASFkbpmYGwShHvYCFXdb2Capy+CvAg rcIg== X-Forwarded-Encrypted: i=1; AJvYcCVcYyjs/vbIN/560qyh88qA0HjWhvD1DNqgPs1pXwgFp+nr06wViG7w6liArePuo0AO+s4BE+oxVU7ofOyzW1NROP65fzgLfsXFX9aF2qAdMuUMjJY= X-Gm-Message-State: AOJu0Yz6vjcyHJu0+7XAOdluRrQ6qyO7KU/8mzf4TuKy81pD0TjnY5XT zBXdrqbxODfH7OX01ExGfH0V8PY045iv+e1M55JTG21Vv1BXW0rWCExNaGPuTS4nldoyhdgIe2Y YknjTEg== X-Google-Smtp-Source: AGHT+IEEkdfVbmMdg47zJ1xwMISs3qxpK2W4sG4GNErhBkvDAcSIFEm9nvYqC0j8/UjSL/PUOvwkYvjYDWoT X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a25:f30d:0:b0:e03:59e2:e82 with SMTP id 3f1490d57ef6-e113d27c9a9mr2472276.10.1723495706163; Mon, 12 Aug 2024 13:48:26 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:19 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-28-irogers@google.com> Mime-Version: 1.0 References: <20240812204720.631678-1-irogers@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Subject: [PATCH v7 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-20240812_134828_051931_A6982212 X-CRM114-Status: GOOD ( 15.24 ) 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 a8404cc99cfc..d2bd563119bc 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1770,7 +1770,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; @@ -2200,7 +2200,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; @@ -2250,7 +2250,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;