From patchwork Mon Aug 12 20:47:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761038 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 C5770C3DA7F for ; Mon, 12 Aug 2024 21:00:13 +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=MRgA1lihGvLTddTTZqgJ/lO6lNaMhGJCMkfVsAIf/yU=; b=uyJhS1e/qknWKe/kVZQrOtHZKr 8vH/HrycJoXHNh6+mWlCYjqd4QqM+7PuyXDv7/YQQ2tx01AMwzmmeVtZfGUMHIuIgME9WbWqjoBa9 rCs7CEAJVwpG8r3dj9ktsA+L5k4EE+PrfX4zT5gQidDdLBYZzsDOwgHNj95Figh1lkaVxbCk9NDhm WiRoqCpgwnJ17b/KWWER4Qcv0VtM6ioqX+7VUoVfBoDsoGJbvOJvYl8IpuwMOGpMZsDZmO0s9nKOM p9fQzQNXfofnedCD88lzXdQT11q1vkZlUKX5M0Cz8wgRCMG54ZMw/3zabmAJ/gTUa3+Si6gqcvpBK tArYNG1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdc94-00000001YNy-3kdS; Mon, 12 Aug 2024 21:00:02 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbxe-00000001Um5-1BGn for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:48:15 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-68d1d966ef7so105648787b3.1 for ; Mon, 12 Aug 2024 13:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495693; x=1724100493; 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=MRgA1lihGvLTddTTZqgJ/lO6lNaMhGJCMkfVsAIf/yU=; b=vzEAMbtLoP7lLnUvDhnPAx2zBll1k8dVsPL+iZSVZ/tP98GuPe8OWZKfrCfHXjToAX 5eTQcJzwkZM1TABki0UB5F+Zrw5/uWSRDq93cEcHBAmlruHjOoRtxxQe//EuixC2w+vK aktiDyTbuy1FhEL494XzIrHDKH1EeQjacPosGEqtwy0/JrFB0wM1KmK6aDn0rA8zRkCR kjwK+6BY4q1L3LWqMnvdFEXoxJZHAFMoE3Hv5X+ycSlVayDGW21hQe0gs5etpqvlni/O YAc9PaH0fPkABEx4BhJ1qezDSCJhSbTqPggW1dmVsn/bYm4SVUX50gE6OITiaZLfnxUn 51ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495693; x=1724100493; 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=MRgA1lihGvLTddTTZqgJ/lO6lNaMhGJCMkfVsAIf/yU=; b=Yze4NWNLcfSWgZ9Xxz44IOmoAUuskpKgoISW56VMsm/aiSo5qjlx7zjopEm0JsMzZm tmH+J6cMAp3VPCqdP5Q8TCLmz9Q9cZuB0jx5rzEWiaK8yDXn4vHXa1rYxFE/PMfCUvvg T1FxOnxNdobcc1dyX4E0CDE8qRob/Q6xzOwbgiYOXyRebfT7WZRKfYdzkGeIJpxtl1lR uRWRXJuLskEo/c69ab3Q2QmK04EJRtDltCE7C3/peHlinlbRZN66sZ1UcMA74wPWV9+R jlUL/wPdR6yyE1556Esmo5na2yBIvPPpV4FB0jeKsl3P3LJzYC0+q2BHB4HZpfHR1wyc bnug== X-Forwarded-Encrypted: i=1; AJvYcCVGZjR1OUFPvFKzQeH7dvCx3CKtcdVCYKmd6UvoVcec5ca8M7ab6xxBmazTHONyPJ+fXtnKmM5H1utrYQjPL8xBesChc/5jLsIkOnJQUyHaFrL0zZg= X-Gm-Message-State: AOJu0YxanWqvCxIjHQ++D+FfXVt2ny/uZAcGlvR+t3WCkTTQC9bIVh9M 0jNiWu7bxlNokRR+jEikRudxGElfc6pMNa6Xf9kAd97O+iK8Z3vovvnbgt/HZ5qkWDmKPcOFtg1 oUKc4Vg== X-Google-Smtp-Source: AGHT+IEjWqSzzD91sKJHefl74i8oWqMBx/tc3sJORhlRuDuK0H0B0q25A5wWaABqAWkAEbCkS0GPuVGqJKBv X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a05:690c:2fc4:b0:673:b39a:9291 with SMTP id 00721157ae682-6a9720a3717mr260267b3.3.1723495693016; Mon, 12 Aug 2024 13:48:13 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:13 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-22-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 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-20240812_134814_346443_40FA00FE X-CRM114-Status: GOOD ( 13.66 ) 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);