From patchwork Fri Jul 12 18:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732155 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 6C98AC2BD09 for ; Fri, 12 Jul 2024 18:18:22 +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=Yt616h8hRCivHeAdqJzIY5ztVTyVV8Crah5Wq3Zf1UM=; b=QJm0EbnzN9EO5/Vr8TviojnhGj jFbP+v9/Ljijq0VzDi77ppp5jLowXGfWq9AcNE+i3+Yo7DObiA7safST3e9Y0vt2dbtEGhN+0p24S xBTRchWKmXoZ5vhVJ2+hn2AI34VROdjkh055y514TNtEeaKUjuskMLa8aMMTbpLo+gDqOpSEmpQlU A390VusJ9QMBCyq5X1Jo9rSjSiOwcZ5TDTkUFBfRO9V/9mD8FMlieyau9fiMQQUEUwwdKLx7OFSe3 QzkBnOilF8DxO8UOo+XVRm+r1RKlPWWV/WBlr6MpbcMLgzZY9eWXCTj/OmjU1TVgOLTtjbTRModRo fL7naKsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKqS-00000000xql-0MrF; Fri, 12 Jul 2024 18:18:12 +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 1sSKlN-00000000vZL-2NGJ for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:12:59 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-650f5b28822so40228657b3.2 for ; Fri, 12 Jul 2024 11:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807976; x=1721412776; 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=Yt616h8hRCivHeAdqJzIY5ztVTyVV8Crah5Wq3Zf1UM=; b=AnKeFpdEbWWxzOCw6Ea+g5JNeCwmNyhjujAPSKudUpUUSYithUlHPiAAAyl1Dy8lr6 GSO4u0HsADi45TO4Dbzeo0BPxSpHOmSivEixpzi4v6K9C7EoeSIjOI4je1EK1cvSyFPZ LtdPNO3U0wWXS3kil3YWzkwCctyNodeJ93YM/Q8qjNN9kVQ015ezOh7l7in0NjOJVDW8 YKymcX+Nw4z7fZCdOx9x4xInqTSaRGAZxiMDPSVPO6T5UuMKSlPn5vckDPxK8r0dguY4 i+CjuYumn9trxCF4SuLh7X+a84oHu5SwPgFAy7EMq0LIp7CuzZj0WUIf+Qs2HczvYuLu Dkug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807976; x=1721412776; 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=Yt616h8hRCivHeAdqJzIY5ztVTyVV8Crah5Wq3Zf1UM=; b=xSXlzvJABpYPBYPk9dsx6VlmA6raTkv1uYKTwpWTnv1Ozgn0Lp6iNvw3DzMILLJqyc lDURaUvEOdZGsb0aW+MPJ/WYM8981w1k/DTidmdKemQXBReIHc2ckcb2DJDdBTM6gpda i+JiUqWYHzcAsg8Y7FLNHB0L6fYZdKNxyjNVxIgkimo5kSjnnWBnS85y6t/7FvTvhrJo A/k9tpnQMousQXJzN9pyoBNW2lQXVcw6/X0nJyk6HphBuP2+i4/b7qzU2XPSVj8bNGwQ DKN4gg21emm6C8t4YLzqR5wlHm84DrsskjdBUpf8GqeRjIVndhCys+Mf+MQrQGlqWk2d BnkQ== X-Forwarded-Encrypted: i=1; AJvYcCWY8mzrNWLOkGOIoscsU8yn854zhx9O6kRPyMRuFPW1NaqtaxA/7f9rKAtFqEUfZK/RtWvKWBhWphYTqVar8bsdQsMHf/gD8i9BpvMBq79x3/8v+sQ= X-Gm-Message-State: AOJu0YzQZL36u+V2hs1y8+aSLxETs4+agQ7+MT/tFRVg+39lpt0f68QH VUwjutmZpisI0Owsdu+0QsPM6bH9FgknQVyNTttknzp3PhM4WgqeCvOJ/fIS385h0/vLUve14Xy iqCE7QA== X-Google-Smtp-Source: AGHT+IEoiv7jL/sMkb1DG/QD598pjkLvo+odw5YGkLQIBl/s8wzmd3RFOvk+HEu5aaX3z2x7O3Zr1FccgHT0 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:690c:67c5:b0:627:dad9:bf54 with SMTP id 00721157ae682-658f10b0c9emr1670067b3.10.1720807976515; Fri, 12 Jul 2024 11:12:56 -0700 (PDT) Date: Fri, 12 Jul 2024 11:11:02 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-22-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 21/27] 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 , 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_111257_624498_6E3483F9 X-CRM114-Status: GOOD ( 13.15 ) 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);