From patchwork Fri Jul 12 18:11:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732154 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 0B60DC3DA45 for ; Fri, 12 Jul 2024 18:18:09 +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=30wTiCp+NVIhDTuqUvYj4YUy4HL96R/Tpq22ji595AI=; b=JKok7qLExKP5A2HS2wQuNuaKN/ tXCejE3sxbMGEKcYYpaVAi5XETr7YQp27K/Qw4L72PC9Ieu62w7+cvMMPQFYVX1weuOrtuVQf1VAA gVp87un0mM/spCInNP5bLnXMfnqvVEi9G7Lo8aUSMyetJ77kQD0wqhoi/vP1cjwC9Mn+lDwoY/erw g05eNg945xMq0IQlx6r6Ihf8EKgCLKb0QONDCVgrVVtSjlzjI1tAz/vijQI2+tJP2OKkQ68CLigAG 0ZfeZpuuDhQgdWjjFrOE1q0Hw47RaFZbcyO4LBVOHGCCb8x0JRaBt4ByJmcjisUdFxIJzSnXbXSdE 88Cr6wKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKqB-00000000xjK-42jd; Fri, 12 Jul 2024 18:17:55 +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 1sSKlL-00000000vYL-3y62 for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:12:57 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-652c6e92147so40538337b3.3 for ; Fri, 12 Jul 2024 11:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807974; x=1721412774; 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=30wTiCp+NVIhDTuqUvYj4YUy4HL96R/Tpq22ji595AI=; b=awaOTKY+iz1Os9RDhxuG0Lg0JEx+h7BP1t3jJLk7bMI8DFeAbj0xEWdSnRB/v/YCkS Xsxkzl8eqYxdwRy2QOsBQ7neTZJjr8t6vdsv8BmhNbizJd7noNU2rPXOZ+H2D77c+2RP k3u/+QPEc7DCVRlmp5UQ2V237FgLaFHwdD+WSJaewqAlxbNGBddsUrxwatr59Q6i2ILU pcIe+DY5qVHV1cwnM9yHOPcm7G9fwA32aWmvlJ7Q7y9iB/iACuf5fBqwZjkMjRRlf1M/ b6fBitGojh9UB/+3RGHu2dLLFK2dqMVIyzyr0VQol/8mE/tZox9AVHWMJhvhijApK6BD ZqRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807974; x=1721412774; 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=30wTiCp+NVIhDTuqUvYj4YUy4HL96R/Tpq22ji595AI=; b=J/iOB9elD80fkg3Finy3pOp4A196Ff5X8hDiwvCQv9zv67GDyGUFeqQzuBWekr97F+ X82pC3g16IOlGB6pP9XLNz30Fy6NNOs98jC8l6qA+A8NLuGjvS/yR2jQ0vWB7j7P68cH LBYvCYEe3K45f/nL4FwKjC4loW4EFN4LyvozlK75C17g1f5lLh/AqyK7GIY2ZoTEhpLE TeUA49BV0BE2kW/R8xrcHRE5kYELzD0/DQu9aXGlv0VxnpesuTZbZFxPRBmF/3sWB0xa /Tj/CrTaPe9Ltno/NYs+JwNZzK7wqfAoOCr0JFKmy6gl1jhsB1qx2sfehtHQ7imt3Kce DKGg== X-Forwarded-Encrypted: i=1; AJvYcCV9BspJUEo4CVmJ8ARI8tF66zs7BibZZ8DRC6I9N8spVDiu33ePRFc210Qi3zByj54Cdkw3EBoYm68b9MhUeysv5Uh8Ay4Lp8YE3AV2TeQSIIdHl+g= X-Gm-Message-State: AOJu0YzqZjd+bZZwZNtrV6N+q+DfgpBlb31yfKiS8QRIvrcpFRNGMDVf csNyZDzETAPCHG0VFZD1UAgBhhXZ5WLcUGm8RoHU5aWG/nQmwgosWOk2669dnAM46PmdES5OkJu rj/ECJg== X-Google-Smtp-Source: AGHT+IGMtuukUah6sKAK0S8MwrL9axUruMElBWLKJaJXxc54g2LyjBNvkewqR7HlUBQ0L+JgA3dM6zS6xMnA X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:690c:6404:b0:651:a724:dd0d with SMTP id 00721157ae682-658f06d9d6amr2241857b3.7.1720807974345; Fri, 12 Jul 2024 11:12:54 -0700 (PDT) Date: Fri, 12 Jul 2024 11:11:01 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-21-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 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-20240712_111255_993512_6E7650C7 X-CRM114-Status: GOOD ( 13.43 ) 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,