From patchwork Mon Aug 12 20:47:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761033 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 0CD88C3DA7F for ; Mon, 12 Aug 2024 20:57: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=KSz3KLOdrMthwKDpYtohwO+EbRwfCbBekFhX3ull1Hw=; b=oB+rkViuxJIuPx/v1pjZrydVmn 5D12OaF3a4aNuVEksAeW+j9HA7q51YFVJ4qcYzkYQCxuAP/yQJzK7Qu1nRgnfYF5PH44nObGfX5Kv GAJO9gyMEIaI7sXgJkO+Md32SCxllVFwxpMxf9U2+66jh0S2nPfJhCk5c+UuXyXMuy7TrZqZWug8O 8bYzw6km9LO9xdztmZYjyTDz/jYhuwaRcmUcaW7L9FJJ01+UWdQO26Y5vVRecvdwuNRTXJ1R+tbfP Oi/DzNmlE+uYIzQ/ZioUGkWP4W1UulV1AxPatNYEkgezS4gpWdlVE3h+/AjUsZFINGdcWlN/mQrVt ckCpG9pQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdc6D-00000001XWl-0ox2; Mon, 12 Aug 2024 20:57:05 +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 1sdbxT-00000001Uep-11sX for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:48:04 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e0b6584bbdcso7638752276.1 for ; Mon, 12 Aug 2024 13:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495682; x=1724100482; 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=KSz3KLOdrMthwKDpYtohwO+EbRwfCbBekFhX3ull1Hw=; b=lmjN9ctHr4buMCMAuJtY7zQx3cWkBRp0AVNVL2a/lBXKknmyVP3coRGrU3UPZqAbNF 6Gzwz5ilAUM6ZikOMHoL3M6M4R1IpGGvc3Uh0it1plTUJgQ6xD4M/SOJEWCTLQBZmYYo H78BZyRZfFgOvQ9AI0cTRH8WFX0aEHLwVRCmZ5sJoRa/+UFNWgtgRlPq+AeMhGUBt+UN hgoyCTJAbQT4o5b1S2U01FZzZ4ZwefAKnyG/vCJ0OTSP9INb3jlqDejDWZKXz97sCLSM Tt2E6V4e2b3mjjIJovBvsYf0hx2/rTROroIFinh7ZICVm3vq7z5lbtHja2a/k9nFInj3 swJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495682; x=1724100482; 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=KSz3KLOdrMthwKDpYtohwO+EbRwfCbBekFhX3ull1Hw=; b=rxNzsN6rR4Mh5Pf3NDH58vXMT/b3rm5kNpjWVaDt1WEUJQIyUdlYvlJrkuZ9P0t1iO lU/ex+vQMHc+XGE8vqgkWLlrLTtnAniM7/36+cb+StI+YZKPF6Md3jUkGzVMXlCt8O0l SKllnEqfdCQ1PsqWgTRi69/v7kTnwMVfHYLesS526j4tYqEiaFfIYsKUSPmgvtVIhViy xmL4fLkM4a8qEJUtAiEedPmDBWfP0lpzHN0X9Xri81LF0uCm739DNXlr7F9o8TTlARbG 8532byf3S37mY3acdm2gKedLjGz2f++7J8w8Hf8bfMwGqRGgDNhqwFLukFiqkoXWqs11 o/vA== X-Forwarded-Encrypted: i=1; AJvYcCXN7Fmculga8W0IPKrDknkMPwZzPZZZlT5k1xFxL466L5kG2BpkvMinGoXaGtQBBkV8L5n0w5dG4IV0Vf8+D9YxhJzXYrlbOj2iQvVVtI7IPDEPTYs= X-Gm-Message-State: AOJu0YwMWX+iWhIu+m3CtlCfpCEojo3PVeD95GCBfyyU+nqPnq282INA Lx8v027KG+j/veABFcgHcig4Jn6GrzTRAftq/C1Iiz/5oFj6SY2JJfH3ETdBB5tkwAO9V2p9qnB TNJ896g== X-Google-Smtp-Source: AGHT+IHuR7xHxfAp/zgJIBrSuShCMuj6OT04czAqkESnYImrj7+2RFVRHK/QMzpEWRcnE8XzpfcpAWdR/JcN X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a25:8407:0:b0:e05:faf5:a19e with SMTP id 3f1490d57ef6-e113ce7249fmr2863276.6.1723495681908; Mon, 12 Aug 2024 13:48:01 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:08 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-17-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 16/27] perf stat: 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_134803_308658_AE26698A X-CRM114-Status: GOOD ( 13.46 ) 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-stat.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index d44e708f8a44..487eff9a8582 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -2271,15 +2271,6 @@ static const char * const stat_report_usage[] = { }; static struct perf_stat perf_stat = { - .tool = { - .attr = perf_event__process_attr, - .event_update = perf_event__process_event_update, - .thread_map = process_thread_map_event, - .cpu_map = process_cpu_map_event, - .stat_config = process_stat_config_event, - .stat = perf_event__process_stat_event, - .stat_round = process_stat_round_event, - }, .aggr_mode = AGGR_UNSET, .aggr_level = 0, }; @@ -2322,6 +2313,15 @@ static int __cmd_report(int argc, const char **argv) perf_stat.data.path = input_name; perf_stat.data.mode = PERF_DATA_MODE_READ; + perf_tool__init(&perf_stat.tool, /*ordered_events=*/false); + perf_stat.tool.attr = perf_event__process_attr; + perf_stat.tool.event_update = perf_event__process_event_update; + perf_stat.tool.thread_map = process_thread_map_event; + perf_stat.tool.cpu_map = process_cpu_map_event; + perf_stat.tool.stat_config = process_stat_config_event; + perf_stat.tool.stat = perf_event__process_stat_event; + perf_stat.tool.stat_round = process_stat_round_event; + session = perf_session__new(&perf_stat.data, &perf_stat.tool); if (IS_ERR(session)) return PTR_ERR(session);