From patchwork Fri Jul 12 18:10:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732146 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 89757C3DA45 for ; Fri, 12 Jul 2024 18:15:55 +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=GLiukIuXpfj1RuwI+7tVJ3j4buaKUCfjcNd2gIIAnuE=; b=X4+qekawrqtDMLl2r4a/+vYKL7 dSi1Px2wCai2wmWfYDZkXiZ6rJutuHXvzO/4FYP1rYd+tKRMQLVXjunAVegh/qQQI/A6JWHoTBKaS ltlECGa6ckj1JbNs6XLeybr5/609AxlPwHi2D+1nOM85B7tZWdhfDd+hMBSfUEeSkIZsN3jRNkZ4M Z2VvSUuoS1LaXjkxiMg3wdaZzxaHuN32xguZGr2ftQKHQu6grVb14/1Zqdh/ncma3I1WphDzYmcCP vVQMrge9DY3ZMoB0KSFn5wUEnwI3EpTpf5sxwxOSGhIivBGAbb31xAoQQosPz/mV+HRRXHMH1pwsr MhF8rzrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKo2-00000000wk7-3Ak0; Fri, 12 Jul 2024 18:15:42 +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 1sSKl4-00000000vMT-2Zpm for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:12:40 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6524309be45so44284847b3.0 for ; Fri, 12 Jul 2024 11:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807957; x=1721412757; 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=GLiukIuXpfj1RuwI+7tVJ3j4buaKUCfjcNd2gIIAnuE=; b=mh7jWvB9QHMWc6mRIjSjo1/w/UqFABhl3otJqI3D/wMXR/BQSB1N2MOEJ7/ouXcelo AZJLLs2bBvujFLrZso25Nr/tEqUX1OH3zBsyzBX+yN2UAli/RCyhhwsoVATdSUEoJK9O NAOarpOHuNbX9EX8N0u0z8tB8XG9tNdS4wIBn/KOE9fm9w7fM2sKuEQLbhcnKvc+NYTi /nCnVWZMkbc7bwlv0mpuIX4oVMv83PaYpQId1vT8cv3tiFJfmLrcR0tCa4RbYGh1x+no ELOr7vFpb33cjzMoWpUgjv7gl270Erq/cUqcLRFznivC62xtLB/W4IPPzv23P8FVc+Mz zJCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807957; x=1721412757; 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=GLiukIuXpfj1RuwI+7tVJ3j4buaKUCfjcNd2gIIAnuE=; b=Wauubtt8i5kVkX46Q/UP1KZf/7y1srbJQvaKu5OS7iVcf6U3vQP0MaKgH59wyi+/Ta TjmN8Q03Cvdokb3cDoEmyN0SazZcGcLpae3ZERB6HGlH+rRN7voiMZScY1QnJQzHdS/0 i+dSjJycgyXlQPoXf/7J9NtehRm408e4aoyl0lUsUU9bENKAASyVo7VEgLWcr1n6bkgn 8ocBhfyQ3ifTY0C16ra82QrHxu2hwWeRUyxN4o41KUoz+V1xMgkzqhHat4Gh+CvqoUHY kSJqkHpNiwVW1i/cCWxu9snnbTZGo3Epa5O4eSqGp3zmQvoJkRWMWlhRy98p2d4u0unk TBgw== X-Forwarded-Encrypted: i=1; AJvYcCV13PaFKV2eAXXIj2lyl0qb3dyHRXZK6K2x7OinYdtQUCwMiv/0kXXLHCMXzSG7KV62V7BkB9vuPWE8NJqBbNGzQlSyeCJ/laiKe6KAl0eJrPvGrnU= X-Gm-Message-State: AOJu0Yw9zYiXK3tqE8wA3YZHwbjibOOb1eko3leVsnCrUWszDhLn+xDU vWzNXs59T7wnHFnz1aCnLbo8EwTM/xfNan72MlmPnj6P/ph++lzQDQhKrfN2WABD+ng7gNIlv2j EcdfRfA== X-Google-Smtp-Source: AGHT+IH4uAq+0GE3bX9Ncu3ZBlmhnrDD+38cgOfHCMtyr/CPZ8u/8k78H/BkrIM5m6XYB9naIU9QLIw6gVAU X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:690c:660a:b0:64b:683f:795e with SMTP id 00721157ae682-658ee5a10abmr2551797b3.2.1720807957092; Fri, 12 Jul 2024 11:12:37 -0700 (PDT) Date: Fri, 12 Jul 2024 11:10:53 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-13-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 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-20240712_111238_660132_6C8904CC X-CRM114-Status: GOOD ( 12.50 ) 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);