From patchwork Tue Jun 25 17:25:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13711723 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 8496BC3064D for ; Tue, 25 Jun 2024 17:27:36 +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=6guPMXmcdW65GtfPCYKyOHBofbB3BqlsDiMCqc1Wqps=; b=RL1zBB9rPj4d4rg6zuIEPLdJZq hKuBYDSy+wTubsR5Z9cqHNmasRJI8Ik61l+2PUlOAZCHTaCFN/47Ncjjvm+Xo+lHFVSQSH5/yV6GE hmMPo8HfinZ9ZEns35oUMH12xCcUxgiPEsyjfbsiBm0bYqObsxdjcPqLw5dV0bQc+GrjtITrb7WFS 6FrYDPZB5/sn5/iXiMVfq64pHKb+F1+ibRvy9yc4MzRLhECsFVbJXm1nlpR+nYbEL/VhxC60MqpzI RGqbD1X3ymDZQDj5t511piIXh+UjIJMb/TZtfK6MDgnKURmLvkvkX5JEpmK+x6JY0nyt0LKkoMMu2 e42FVoHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9x0-00000003tFj-00Hv; Tue, 25 Jun 2024 17:27:26 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9w9-00000003sau-2a9T for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 17:26:35 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-632588b1bdeso110174847b3.2 for ; Tue, 25 Jun 2024 10:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719336392; x=1719941192; 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=6guPMXmcdW65GtfPCYKyOHBofbB3BqlsDiMCqc1Wqps=; b=IU8sguivNMHhGm/gHiQYXAFPs1qzcOcHz6RckGMn19Lw94JLSa3dY0t0XjYWzjaWf3 PImlcydeXTMVE4DqbzUnZRRbQDLi1XBM9LowR1xAu4sxrpCDS0fLDkCWJH0T1FIR9dyi ws1xSn+XFRe5DElCoTnn2DV2VMSe+eFZbOQCHjvnzgDcbWKEkijE5aczDSzcP3gqa8Zm wxIHCpcdPHvkV1II8puncgjvFj+TvsKe3t1tVvvH4FXsfxPjj0Oi0Leza4TTX8sEwerd pkPFoEub117lWQrk12BxMRYgTMHf7YJscVT3/Vm+Ce9WBo8Gb/15OLWgPmk43yCgyz+e NZTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719336392; x=1719941192; 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=6guPMXmcdW65GtfPCYKyOHBofbB3BqlsDiMCqc1Wqps=; b=M2cWvQBNfUnU/Q9/IK/MiSVz9Vyb6Q1TJA7siIyjvoZt7GavA7EJ0s6L5Vun/W6vG7 RdFQ28WkpFBfxHHocgduHA+kuWbMr7xgf/tO38xpDPrJhuZTQlob0MtniMonRcEHZbfB lTQAKbpZDai7p388gAqa9kvCFO71xCqZwiTS++RvHTfdlAC9XuuPZ73SEJdbDi4Di4HP 3OlCIxvZvcCYD9TOjvCIdvbGgbfxerISLTb704+lK+0hCywaqI/2Hh5He8sOh/ATPF3L MI/kI4CK+RLkS1EZRDSYuPFdugaH/5muL0IOolp7Iq2Y74TduJYGIUL3rpxePd1JRmaM r0Aw== X-Forwarded-Encrypted: i=1; AJvYcCVJCE9jSCUvC6IGCxLB2xqjM+XApyfF3tAsTGeUH2d3n2D1XIa3qOf/70CM4CrIHK+AZQkFrYXNbg31n/etXo0x1YaP6WMTtP/F1S5tSsne8ab975k= X-Gm-Message-State: AOJu0Yy7pVgFtIJDL/itak7ub2PHXbXVSc7kQOquWtlV0eOgpyCpn25C pdsOUx6Iym4NZv1bVL+Aeov4PhsqJ54faBlRkOVwMlfLWl0vfyLVdRADsUT1/rfTAz/5vvLTDHV HupwpTQ== X-Google-Smtp-Source: AGHT+IFV8nFgbzCmqp5624khLyjgblB+C7PSMAG99rhpEHx97+eQXMZPvyVLcBZvUnoqdEaw5LZAWS/mgVDn X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:b4cb:a52b:f9ea:8678]) (user=irogers job=sendgmr) by 2002:a05:690c:fcf:b0:627:7563:95b1 with SMTP id 00721157ae682-6429c6dcf91mr317197b3.5.1719336392078; Tue, 25 Jun 2024 10:26:32 -0700 (PDT) Date: Tue, 25 Jun 2024 10:25:47 -0700 In-Reply-To: <20240625172603.900667-1-irogers@google.com> Message-Id: <20240625172603.900667-11-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 10/26] perf c2c: 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_102633_858687_7FC55792 X-CRM114-Status: GOOD ( 12.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-c2c.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 88c131d05186..cd2bd573bfc3 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -385,24 +385,6 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused, goto out; } -static struct perf_c2c c2c = { - .tool = { - .sample = process_sample_event, - .mmap = perf_event__process_mmap, - .mmap2 = perf_event__process_mmap2, - .comm = perf_event__process_comm, - .exit = perf_event__process_exit, - .fork = perf_event__process_fork, - .lost = perf_event__process_lost, - .attr = perf_event__process_attr, - .auxtrace_info = perf_event__process_auxtrace_info, - .auxtrace = perf_event__process_auxtrace, - .auxtrace_error = perf_event__process_auxtrace_error, - .ordered_events = true, - .ordering_requires_timestamps = true, - }, -}; - static const char * const c2c_usage[] = { "perf c2c {record|report}", NULL @@ -3070,6 +3052,19 @@ static int perf_c2c__report(int argc, const char **argv) data.path = input_name; data.force = symbol_conf.force; + perf_tool__init(&c2c.tool, /*ordered_events=*/true); + c2c.tool.sample = process_sample_event; + c2c.tool.mmap = perf_event__process_mmap; + c2c.tool.mmap2 = perf_event__process_mmap2; + c2c.tool.comm = perf_event__process_comm; + c2c.tool.exit = perf_event__process_exit; + c2c.tool.fork = perf_event__process_fork; + c2c.tool.lost = perf_event__process_lost; + c2c.tool.attr = perf_event__process_attr; + c2c.tool.auxtrace_info = perf_event__process_auxtrace_info; + c2c.tool.auxtrace = perf_event__process_auxtrace; + c2c.tool.auxtrace_error = perf_event__process_auxtrace_error; + c2c.tool.ordering_requires_timestamps = true; session = perf_session__new(&data, &c2c.tool); if (IS_ERR(session)) { err = PTR_ERR(session);