From patchwork Mon Aug 12 20:47:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761037 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 8EFAEC52D7C for ; Mon, 12 Aug 2024 20:59:37 +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=TBLmjv6eSiS+LVg3S2PV1+TUybOzhv0kGBRJg6B19ug=; b=DVlS3fED0Caz5QiYrUFfTeAboa DcfwZxAn7zVvAVVN+ZbGsIKEgLEdJB5UvSykl4GXf0vmnNYKdT004VzOxgYKwy0cEqQ/J2/j6YZGU Pg77GqxiSznEDa63Xww0tTuCL6fZuyuEYzOcK5ecqGHcci9vh0mqSJ1klqMwpWdZwShM4Wv0D2EQW LzMtT4591A5HlZn4thJDMQEJ0l7qGYlcxGXiQNgPoU91OILPby17myWbev7olRmWfTeSn3vM5J2Rs 1lr3OYVS/xiyiTZBRRkdKAh2vBHlyqhXMSvr6S1EYqa5p++AceGWNDLBb9DV7avVjfR6c0N/roh10 o44EdkYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdc8V-00000001YGP-48Id; Mon, 12 Aug 2024 20:59:27 +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 1sdbxc-00000001UlN-0xMz for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:48:13 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-664916e5b40so68397837b3.1 for ; Mon, 12 Aug 2024 13:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495691; x=1724100491; 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=TBLmjv6eSiS+LVg3S2PV1+TUybOzhv0kGBRJg6B19ug=; b=WRno6HV+9bvC9B+ygWaDbo/dpIS8+MDRCqCVcS8iPnDsbeb1GDq+lcSlqA5F/8Hkfz zMgQEGsqhyVtqPRZPiioUI8zIG+8zPqWSt68ib40Q0ULEXF0GXy4fNVlS7zcV9kMF7x8 Rk91pnT5tqMd1qJZuyrNrr+vTjxHlN2KuGpb+kaqHK593fa7x5WOf/kfTJ2Lo8PxDi64 ukwuP6TKH0tBkSca+iasmqo6V7xsNJ/4F8xqNnITbqxC5LbXA10brSqciw0meKv8Ndkv n8E1GdpFjUKzwbiVtglgKa8Nkfx6vat/3tPlKvAYp9fIDb+cF0nPqOduF+s7qXxpEFmU KVbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495691; x=1724100491; 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=TBLmjv6eSiS+LVg3S2PV1+TUybOzhv0kGBRJg6B19ug=; b=nUJ/ljHFydQ+oWZ8m/Kd7f/tpUE7revrJs0yBCx6yAkxIey6vDEAduy6YtfHV4zXob Tne1MKJ2YPA9q+BtWF5P2LnatXE83A4xecoK7HSsfs8if37Z1bbMOG64H/GOGn1xmORB sSQ79B3vfFnvSQ6UQIHoXuKYBaDiaTIB9wZFMYQdBCEt/2pb8z7Zg2SEPzYKpunSOcQY 5qdJ+zqKbMbCY9B/Qg3G2Hy3gRIulGGKon0bizMZ9YYhDdxVMf7OyqgoQ2DSzZinvZhU swCOn8AY293uzbMWSf3dVmxTI+iBCt2jPeurKObeQrrwHUm0fc4f5L5GyZdOrWATo7es UF6g== X-Forwarded-Encrypted: i=1; AJvYcCXWkgYhKIROSWOeSZN5bqQl8DzXSU1y8L9Mv+3by0vRpByzA37GNJ8rsBGGGZmCs5EUWo0qZpXJ/k386a+a6TXE@lists.infradead.org X-Gm-Message-State: AOJu0YzD2tmsAd7S8pxYmW7wpHeoLXICMcEjatWMOGaM6zPW2pbCuKuv xso9+g/GwzWZJ4jaRhP1NNqdr+LInBW5qSJHnJgiCAJGyV71ekijHTgmBf7Z4uj/lKLtAgoTnzw vTEZaGA== X-Google-Smtp-Source: AGHT+IEascsmAbLnMnqwNwXuztrEwJNeZPYC78oqAvFDGFQpaT3AICojo24NJLf0dEcSdbHI+4hFkDNL2o4u X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a0d:d006:0:b0:665:7b0d:ed27 with SMTP id 00721157ae682-6a9e565a222mr104757b3.2.1723495690833; Mon, 12 Aug 2024 13:48:10 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:12 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-21-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 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-20240812_134812_290616_82656601 X-CRM114-Status: GOOD ( 13.94 ) 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 --- 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,