From patchwork Thu Jul 18 01:00:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13735911 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 E4F6EC3DA60 for ; Thu, 18 Jul 2024 01:07:23 +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=fnEjjhiFWiWK1ZjHSoRI+4nKrjjHTPs3eA/kl5KV2XA=; b=rpODkve54p1kjufa2jzDS9ZfMS soXoDnp3+ZfqpW2/VQsA9LexEaLTVbZq1fAc2qjuhiZvHveEcpBxnU4XtY9gCEKA2JZ7+Ugx+rEpK qnELWpx8gDHlpJEgxsETt/RF84ha/qAy3S+AckxfwpQToSkJgwdk4Xz1+SVslvuaqgD50AXgKrwUo JDQi5K1JUT3RBIQAk5TR+wF38UgXhifOac/Ux3gYgy66BSBa7stTU8VvWchLMyGvWzbv0M8po5g73 jzYYFzvwnzLtCWoseVtKXlOnUzflGwNFURYKGZcIdW+ydBmMXltvt7LXETHqRGIMjcJR5Uuhq9+ld tgdv+r5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFc1-0000000FM5y-3SX9; Thu, 18 Jul 2024 01:07:13 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFWO-0000000FJmj-3cKx for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 01:01:26 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e05f08adcacso782421276.0 for ; Wed, 17 Jul 2024 18:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264483; x=1721869283; 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=fnEjjhiFWiWK1ZjHSoRI+4nKrjjHTPs3eA/kl5KV2XA=; b=xFlPipDG0WLJT1SEop5we2K2RA8OrNPWa1y1PFbbzL77srMra7J191kAP7vnA8paDb LF4+pKuCEAaTw7EwdKJfZoQEikxs0ILGZ9Sc+sXkIrPg8o0mM8+oSMG8540d2n0uFZ+j Og2KWrMRSD7mNyuVBJ939vcInR4+tLK2YLUDDyP+p3Y9RIXnCn/nE7ZEFIlx/kJRAJ6x Vzv1cmjcDsOAvgPoMSTSDn3Wj7NIWjseMslTmtjfILpDBynZbVXIQ3q8N5HSrKjuz4AE 3xUE0sk/+xM0yV4X2AWlSI5zLFj0+8hgRrw+GoViKI3uGJ7WcS3MsIb1tUyfwFo3scem R6zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264483; x=1721869283; 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=fnEjjhiFWiWK1ZjHSoRI+4nKrjjHTPs3eA/kl5KV2XA=; b=M+yM14zjgAX5neohIK4JH7KQXwRbSx6R2Mlz0SNiPZAPpbNr9bGOpKatdnMcuLPSIE w9wKmYuF9/rQTvNWrtghyprfPnpv8Iy0DlekR9NX4vro01k8THMrp/0Z3/byB5tBhle/ n6+Fb0pI6xYFRxCyYAnGf55D1nPZv9ZJ0aw8yGIloDXgGWQLrtbNACTisDJANnkQivmd pPf6cQGsmgtwm3etULopdTDHbJ5aGXnyv6CgVbb8q/PabO/hTEVYnzhZqecvBUlLNVYJ MHvIgRz/Jm4AhDI2l1kui62Xmq2C/xo2ahtXtWrKDesxv+U0zTz2fo2JCw9LrgM8epUP cDnw== X-Forwarded-Encrypted: i=1; AJvYcCVMT5FOpgWiv7cB2uYjdns/yZ6t/ga60/ldPuCo+GElOCEJL+CVF8JNzNiCjJC3Gl+QZy/Z7KWX7hB0MiZHqTZU0SCRcGkzs6knTD3253fZbt03eqY= X-Gm-Message-State: AOJu0YzWrAAlztuIGrrtEGQhfwQft1nfWEpp0bnNFmxIJ5DEbCSbXrjW LbdfddRY1KnMvav3x9MTWH6XbAe7nM/czfrmmlFTaLNYIVpxXAYp7TOrDivLl6oTmmxBFFZB6lD LalJn3Q== X-Google-Smtp-Source: AGHT+IGc02dcns067S/+Js+jqFzEtFv/PZyENgn6kRY6kp4H5xE8Md1QOSwjwqbLR9srevWvPq7mRSuwgOSG X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a5b:885:0:b0:e03:5a51:382f with SMTP id 3f1490d57ef6-e05fed80951mr2244276.8.1721264483228; Wed, 17 Jul 2024 18:01:23 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:16 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-21-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 20/27] perf timechart: Use perf_tool__init 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_180124_960891_3CD312DD X-CRM114-Status: GOOD ( 12.58 ) 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 Use perf_tool__init so that more uses of struct perf_tool can be const and not relying on perf_tool__fill_defaults. Signed-off-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/builtin-timechart.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 5bf818baa662..218c8b44d7be 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -1606,10 +1606,16 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name) .mode = PERF_DATA_MODE_READ, .force = tchart->force, }; - - struct perf_session *session = perf_session__new(&data, &tchart->tool); + struct perf_session *session; int ret = -EINVAL; + perf_tool__init(&tchart->tool, /*ordered_events=*/true); + tchart->tool.comm = process_comm_event; + tchart->tool.fork = process_fork_event; + tchart->tool.exit = process_exit_event; + tchart->tool.sample = process_sample_event; + + session = perf_session__new(&data, &tchart->tool); if (IS_ERR(session)) return PTR_ERR(session); @@ -1924,13 +1930,6 @@ parse_time(const struct option *opt, const char *arg, int __maybe_unused unset) int cmd_timechart(int argc, const char **argv) { struct timechart tchart = { - .tool = { - .comm = process_comm_event, - .fork = process_fork_event, - .exit = process_exit_event, - .sample = process_sample_event, - .ordered_events = true, - }, .proc_num = 15, .min_time = NSEC_PER_MSEC, .merge_dist = 1000,