From patchwork Fri Jul 12 18:10:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732150 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 19607C3DA45 for ; Fri, 12 Jul 2024 18:17:01 +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=GhKzAhRYOz6Ff/7gM3raH2p2+7D3XZwc5l/hw9g7Qeo=; b=sVIkO4SKvOmI6Q1+8GZXUggLBp obkurtv/dcBJ+bsEc0jWcdRtqzdrqOqgvW/wSS/7SCGW2EGuUrKcjXXN5ySqNO6uGCWpQQauM6nTw nXE5ABFYWr24acLkdQZHpHjIFqqV3grfp49VkRpLwA15Asd9cmVJu00huH2WZ/Z+3tzYuwCdnKZJe WztE8659PURhCbQ83lUeWFCIM7I9UeQLM8Ffx0wAds5z0xP1NTsMCe8/wkMDVujFzEXjIf/qjgXyD 8vPQfOL4Otvc0a9CBKTDrtBRuX9UE4xzgGlZW28JqYM3ZNVZtzlqCx01lpFArkriMPTB2E9aUDt3B Xr9WrXSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKp6-00000000xCj-0AfO; Fri, 12 Jul 2024 18:16:48 +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 1sSKlD-00000000vSZ-0XhK for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:12:49 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e03a1ef4585so3999353276.3 for ; Fri, 12 Jul 2024 11:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807965; x=1721412765; 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=GhKzAhRYOz6Ff/7gM3raH2p2+7D3XZwc5l/hw9g7Qeo=; b=YTSNS2YUAtZx+hAH8qDAKucXFnyFlc92Z8Q+BapntTnLsaAYKJfZFU6D5QmmrjF8ko As5URYW7NkYXIKbq3cO1ioR2rV6oodhkSNyu59yk+t8r6Tb0SM26TV8bmmjtroAVvGsu 8EI+0AEIdEnWLoAkSqXr++UIsi0kQyHDNzubAs5RRpCpyJRGKuTgya6Q8z8PLsoxDH0W KTUBN748TZanCIrSkDJRp+0srezKlAbVzvad6PH16O7031WTWHwCCpitTx+3VhlErTox 4nhcUbZiWDLnZd0qgPfqnOBeJaN5RnmnD5aI/oWpWYBUbSPnney3MJVDdmz3nMaA+k/i zR4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807965; x=1721412765; 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=GhKzAhRYOz6Ff/7gM3raH2p2+7D3XZwc5l/hw9g7Qeo=; b=V4PA/Vh8xQjKEBi1JeIm0UojJ/ZbLtiiMsI6eG5Cemlo7a2D9UPh9ARs21Eycg34T3 NXQfb7oeZ90Z2F3VNI8pcutTiS3uSRuH0hCETQkV5ir+hwtDWxmS4z0pUBAUHtjrNd2d fDyrJF9NXT6eTWwvGzFR6Z+YfK2pDUIXBUAkRKXWQGs5DxrZIFVdbG+8gIz2LRk8Blfx cNIf0CRALimHNWJBbu3xZOxvVMzgGUn3/SnRrunEvqGytr1RPM4yeLN69M2qXvDzqVVB ftrAXakQj37an8ZnZErRFUoHoYGlQ03lFNvl+OFa1xgdBgCtzWZh0nCWETmZ2RiTLbxF hEjA== X-Forwarded-Encrypted: i=1; AJvYcCXSaL2khMqRkD1ZZLIvmVOtNaQnHFFsTNso4PwCu+xwM75z3btb5zwBLUNwx2I3a3hoN9uYU75AC4HDF31oZSkov/Q6GiAvSKD3dw2ub+w/RGHbMK4= X-Gm-Message-State: AOJu0YygELiB4oGVVXlplU0gEmeWKIA8Xo5XgyaPg0TyTwowqh7S/r3D qP+DOKgucBb1vFAsMWp+vlBC3uOM/W80cdpu9b0reIMSXOQWaRZXU/9gqUJKsnk9xua4o+wJzpv ZQoVmew== X-Google-Smtp-Source: AGHT+IFhYPk2jTBuMlhB8gOtTxMBnApQKnxVWvq+XTICOK0WnJmqAo1AkbwwG2wHV+rrMbesLDOHGcXiSffq X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:6902:114b:b0:e05:74ca:70ce with SMTP id 3f1490d57ef6-e0574ca77fbmr459024276.4.1720807965562; Fri, 12 Jul 2024 11:12:45 -0700 (PDT) Date: Fri, 12 Jul 2024 11:10:57 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-17-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 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-20240712_111247_181223_C840BD13 X-CRM114-Status: GOOD ( 12.95 ) 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 d460c46f15fd..a3d77a55d17f 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);