From patchwork Mon Aug 12 20:47:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761029 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 E480CC52D7C for ; Mon, 12 Aug 2024 20:54:50 +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=H+nsPHTHHGayzU+LXZk3pnh3l+7HMNM65zEgwyXyMdU=; b=OB4U0CCiHwZWCnO6TMRnLOljOj zV7WPT63bHqli2lAlTbVZ6AcBbvJ6V/kpE1guMJ9j5R6kLFT2wXIfrTvxKaMu9GsqhxaMfcLMFpQL Fs5LAHLJ5+d0Mr6oou3eCx89B7KnyJVyPd+9Ncgyvh++cWf36STz+VkWTb6LFqmJnxB67PSfeMiFP DLB7jx5d+ETAH112w56IUXdQH+UpUhGB6hBHhitUz/Dd+1SqudfpyBAk0dEEORRrOYhbz3rzWqHfZ +T7ZZ5cppMx1KTGmZoPkbPiN2uvM7963pojKSielLoF0aZXxnn3EWOyOtQ4t0QXO/iysouhF1SEX2 Ftaj90oA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdc3u-00000001WoB-3EXn; Mon, 12 Aug 2024 20:54:42 +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 1sdbxJ-00000001Uaq-3VDO for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:47:55 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e114387d27aso215852276.1 for ; Mon, 12 Aug 2024 13:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495672; x=1724100472; 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=H+nsPHTHHGayzU+LXZk3pnh3l+7HMNM65zEgwyXyMdU=; b=WNtvvuKsYZGypf/uwn6xB9loXF3jdub8wprHK7w3cm1A1cmn4uakZ9URFFcNnyYmOA wmsdJUP9VVNPvZnqaJfHKJCGsCfQj2Upr3nAQAdcpqs730YdwGrFPKO85zbUZ8OrvtIv mL22hbwb39wpJ4qOIRP6Vs0mW5PJD4JBK89KBaTsCv6UZoijf65C7DhpPIwbOlLUvYsq hrkV4aePjIVg7DFO7q1LHkfgp1XbO8RZQsSrvO2t3pA9LQMbWyDykrhl/O9ih2rcCTGv p+QCVFOXSfgULLGdHs1I1MlL0yasym3uHihcIYsFLQu9EoggfOhen3DMOqETX6QqBkQL yvlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495672; x=1724100472; 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=H+nsPHTHHGayzU+LXZk3pnh3l+7HMNM65zEgwyXyMdU=; b=krkIizfL1+8FM2LpYSCmapT7mF3Xj2pMZV5Sv7vpvhVqU7EjlNHgH/n1mup5CicKwT w5OTzNaEOpPuyHApnXtFB/WhE3N4G8480ZQKbI3W9UcIkT1UyAH61x5v4WQVJjzt5p4Q /UKHMuu630bRYI+VAEupqOePiMglcNb75j5dyd8uYZmnypA7j9r44hyuvLyaTnjnKfi/ fN86jeZSr11qPNqyc0I8E4eMXLepe8M9J5E/f6VjWhU6Lglp9Zw3S/3EowpR2pxQ3O9E jUGh0rnys8pxFNYWMbYWudEWuHGppzL5aVv+YgYiRtzzsUiYjytHmXzT7NE/Wrd0W+WL Eu4g== X-Forwarded-Encrypted: i=1; AJvYcCWFaR7YJARV4cfrbKhdXh+MZN0Ns/YXEql42BNJeX5qnEH0DudRHG4lx+dB2LS9sPKMgoJZWzDRWOMowpRQ+bBCYxTn+4FqMYpntog16G2YfBPcPvM= X-Gm-Message-State: AOJu0YyYg9+bIKYypdvsW9e7/ds1oSctOeXJPS+dRI4q+InwDyGBFl56 FuONZCswf84uAha0JLXg08GkRb2adxCngTtDLV0zIXq6tSqeIQAtJ4rPKWITmzJ6ri6TzQ/Yybj 97qRjlQ== X-Google-Smtp-Source: AGHT+IHaVCmGUqBY7uxyQBoBTmxx2l15/jbG59J06sz/NFX3hwioeaXKnIwZ4mNQYTPD7YuKY1X5NozY0ofL X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a25:ce90:0:b0:e0e:ce2e:abfd with SMTP id 3f1490d57ef6-e11408842ebmr14655276.0.1723495672523; Mon, 12 Aug 2024 13:47:52 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:04 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-13-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 12/27] 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 , 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_134753_896825_B0F82B0F X-CRM114-Status: GOOD ( 13.01 ) 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);