From patchwork Tue Jun 25 17:25:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13711732 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 B34C9C3064D for ; Tue, 25 Jun 2024 17:28:44 +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=g+eUWDVM6QBZsAa2Jo8FHym45eB780ogdLDPw0XzQlM=; b=oy1lZNEKzN3s6JRybgU56Z770F I5Mw/uGw7O5Fzb/fNq5BbRDeU7hOVlItF7PI43VEatuFvTGldPA2qpt2/nG1+Spv7m4+OOFk2qbw7 mwQNTFhNfBBhWpCsg84tB1I2Tppb8yOhMfiLXwAnsWDo+Mvcum+LN26KVVm3AgoRzXLWPz88ITTYW 3Fjr6r7XMRtooTsMNwn1hDcIoLXUAseHkEOq/1Ya+dGq/ED/mVu4Ufq+47fNpgEPPPetluqH0v6kA OQFG7BureQujb5wOZu3qLq56l2jSPXo33k1B5lmcLI2CbRyKck2fPFfAjPgpH9NRozfCmB3tsMRrl t3a9ScLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9y3-00000003txf-39Mj; Tue, 25 Jun 2024 17:28:31 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9wV-00000003ssN-22sH for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 17:27:00 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e032d4cf26aso872688276.3 for ; Tue, 25 Jun 2024 10:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719336413; x=1719941213; 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=g+eUWDVM6QBZsAa2Jo8FHym45eB780ogdLDPw0XzQlM=; b=FL8MXM+iyN9ifIOsRJDH7cVqv5mBdJ8hYv1YC/bO6+ZMZ1Tc0gvnV24TdRh56MTZ9F qHx1JLJvrbJaRD1UFKSmCrQByJX5cukOR9FUePIEIK7BSoq2f4xPK3c0CcH++yMNpZMG +f+Y9YojO7TKkNjbdO+HRuUeUmvimPfaMY2BzNTHmtVKY3l3wEFP/VgBuIpBrx7u1/70 c8PTN7SK/8+23MyyNNgg1n4rwcblE2TYCFU0BTR8lwjB8Bct84t4YlRRBpow2tnu/dnp 5Yh+LE1+eAi3bN7NzxEPk/IkU3Va2aJjKeydRyNYbe9n9Azmr+jgXCjx6cfC1o6hiS7B 7eNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719336413; x=1719941213; 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=g+eUWDVM6QBZsAa2Jo8FHym45eB780ogdLDPw0XzQlM=; b=MupUlZ+9WI3jFEbqzIWQcPHGh40dSX0jihOLy7YyGm14LHggCA9eq+zqO/ZKZufSkW IZywt3WVxgo9DdWmpsTE5cEyx9AKluFyaxa5gh5s89aGWq7dW69+yf7dstt83d54ir7n XTOfy7FuTvkDiK1zVI7TM8MbuMB1nuHxIC9/RcZhsz3qhMwCqKXkeWQmXWCsEW0h75Nc WPDc7CIaEfzh05j7Je2TWyGMINdORzhgHZPU65yIFaB4zQRB7Mecydc0j3DTvqAeQ5Gc KCSJkBLkiZpW0aAsBZgZ5s0hoXHzlDbZeNigTzmwJWHRAE9L2en/GODFA9fEfE6Ag1I+ el/g== X-Forwarded-Encrypted: i=1; AJvYcCU989+u1xEo4i87hcNyrpBFpMVrPuQ40QPE8lg4A5zcIXDP7f6aetKe8F6MF5kVmDCrPMvtE3VChj9yheIuM5eS6PjRA6/uSoQQfCdaI6h4516a2V0= X-Gm-Message-State: AOJu0YzCSPO+qKVDI5agHUVzpSduTdTRhF62SLHLg+b/Jlks811ljBKQ fnKEcLPX/VGAlUwUz/JjvCBIO7ETJTjboI0P7sdM66l6GJtpNJuXGxjUl3x24BP7p1N0FlgQ12c cGCc/ZQ== X-Google-Smtp-Source: AGHT+IGYUWAk7sz5e9sFF7M41smXZ1CEVHp2Cz1P5m1lWGWU877bLmIa5jj7HXTTuyGtmfk+3jtWIxnjSAp/ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:b4cb:a52b:f9ea:8678]) (user=irogers job=sendgmr) by 2002:a5b:609:0:b0:df7:d31b:7a29 with SMTP id 3f1490d57ef6-e030412398amr101841276.12.1719336413209; Tue, 25 Jun 2024 10:26:53 -0700 (PDT) Date: Tue, 25 Jun 2024 10:25:56 -0700 In-Reply-To: <20240625172603.900667-1-irogers@google.com> Message-Id: <20240625172603.900667-20-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 19/26] perf diff: 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_102655_906953_E858E295 X-CRM114-Status: GOOD ( 13.08 ) 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-diff.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4c0567882a7a..28c5208fcdc9 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -467,21 +467,7 @@ static int diff__process_sample_event(const struct perf_tool *tool, return ret; } -static struct perf_diff pdiff = { - .tool = { - .sample = diff__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, - .namespaces = perf_event__process_namespaces, - .cgroup = perf_event__process_cgroup, - .ordered_events = true, - .ordering_requires_timestamps = true, - }, -}; +static struct perf_diff pdiff; static struct evsel *evsel_match(struct evsel *evsel, struct evlist *evlist) @@ -1959,6 +1945,18 @@ int cmd_diff(int argc, const char **argv) if (ret < 0) return ret; + perf_tool__init(&pdiff.tool, /*ordered_events=*/true); + pdiff.tool.sample = diff__process_sample_event; + pdiff.tool.mmap = perf_event__process_mmap; + pdiff.tool.mmap2 = perf_event__process_mmap2; + pdiff.tool.comm = perf_event__process_comm; + pdiff.tool.exit = perf_event__process_exit; + pdiff.tool.fork = perf_event__process_fork; + pdiff.tool.lost = perf_event__process_lost; + pdiff.tool.namespaces = perf_event__process_namespaces; + pdiff.tool.cgroup = perf_event__process_cgroup; + pdiff.tool.ordering_requires_timestamps = true; + perf_config(diff__config, NULL); argc = parse_options(argc, argv, options, diff_usage, 0);