From patchwork Tue Jun 25 17:25:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13711731 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 54B1AC2BBCA for ; Tue, 25 Jun 2024 17:28:33 +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=Ygd9VSeBzmgIFn0KNDzBnTE+heYOe9Db6FtOSFvMpYw=; b=q8Cm0xn2+oKThqil4rbd7+pSE3 wO4IW0tKu1jkm6r7/nGB1NxPyODmAstO0EAVIPkL6rboRsrvKP94rT3y04DPBdlN249Z5uj8b3YZ/ meftj2Fu8D1/z9H7fuszHHaNuwDnzC5E935L/C0jQ3NBDdeReaNFkGmcw2NbxvNUbRAZgrbCgc/0J mX6iArcK52K9br8LpcHvfE5U1KNa2AbQl04POamaFNHEFX5wp2O7jvGWhr7MeF7RcEPhMpS46SMlr h6TYy98P280R9qO/wt3o1BTZLo9Cnd+HavUwnrny6FiFY74klw5SAT9ttbZGu+zkEYs5akj4KLRyD nHmtlxRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9xu-00000003trc-2qGU; Tue, 25 Jun 2024 17:28:22 +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 1sM9wS-00000003spw-1t7O for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 17:26:57 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e02f7e5be48so7202122276.1 for ; Tue, 25 Jun 2024 10:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719336411; x=1719941211; 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=Ygd9VSeBzmgIFn0KNDzBnTE+heYOe9Db6FtOSFvMpYw=; b=UAFplC5x0HumObjHP/ijCkCNo2pEc3iMeolLThp/jzCBQJRAwbU8rLCxpg4Xjxoowy tEg/ELshR7SgEQcK+t9G5EiQQxB0q8Rg6O4i30mJTJQpr9CbDPnjRSEU/NZJQEqRn7R3 owHOQ2czUk5+FpOpKeuGfyYjTDRhdqlLrMTZdjYXytHSVczDvzUXfdkGpiSLNM8MDWcx jXMbE8HljPO/QwMeeHA0vfNTiBmLLrvMLYouxInkYnIWK11fxIQ0Q9siqYZ98QZXtkVV ZRwM06qTD0QBEsj6ErUlcOTFSvb2XYQtMKdUl2oM+msHY07d6lQlytsOn+JcVcDHZKsn OzLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719336411; x=1719941211; 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=Ygd9VSeBzmgIFn0KNDzBnTE+heYOe9Db6FtOSFvMpYw=; b=Rw41EiT1UeIYUj8aPHemE6EIjyKY3m8xr7wuKrO+m1wERPl+IZPTzeF8CP4JHUymSg MvszqWwBizbrcH9xnzMIkNBLNzVXnkfmxK3SQRCV79+Oa/bsogAtqt2zcv4QkgqsIzn2 h0U7KYyt5GCGCwoRNvHl5WnCXMbGfU9ZqeDAHKes03iTwjH1gomR9ux+Eih0u6hxy6yp cDxiMqoV0WioKUcDDWZYotzhX2MAenXRyGGK7TN5jLwmVzZWrrtatCk2+u3wvsjfUGe/ FPD394J21PZ022kR2D6AuWBDchyrFbnVm6aLATVSQAUeBZxtFQ77YkEoojJEAOlpo1A8 REaQ== X-Forwarded-Encrypted: i=1; AJvYcCWjRSVTcv8HHOxaDXLbBY6cPDAXy1bTeDH5BQSS8DFMRg/zha27h0mDWBU78EJWIuNcYF6adIAy9Chx7HnCnn0BjupUVTyCdS9gA7XHS9SGV/XkgF4= X-Gm-Message-State: AOJu0YzW778o6QlUytBmkJ+EiexkMURiV/Ym9VCMxvfYPpsuaJSS6+o+ ym13o5wZ4jojtC2iKp2LVXMvYD93QlWSfOmk5FmN2qx6Ui/noUAJH5JcF2ejcW3Krwlr/sL3gG7 dMkogdg== X-Google-Smtp-Source: AGHT+IGJqb768geaJ/+3Dza1yAwPrymkaebPJuzakVPlvvTG4c9cKDtVCh89RfUHal9utqfZd1Pqsy6N9wKe X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:b4cb:a52b:f9ea:8678]) (user=irogers job=sendgmr) by 2002:a05:6902:704:b0:e02:b093:dc1f with SMTP id 3f1490d57ef6-e0303edb60emr31284276.1.1719336410683; Tue, 25 Jun 2024 10:26:50 -0700 (PDT) Date: Tue, 25 Jun 2024 10:25:55 -0700 In-Reply-To: <20240625172603.900667-1-irogers@google.com> Message-Id: <20240625172603.900667-19-irogers@google.com> Mime-Version: 1.0 References: <20240625172603.900667-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.741.gdbec12cfda-goog Subject: [PATCH v1 18/26] 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 , 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-20240625_102652_667083_D5729354 X-CRM114-Status: GOOD ( 13.05 ) 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,