From patchwork Thu Jul 18 01:00:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13735907 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 90487C3DA5D for ; Thu, 18 Jul 2024 01:06:09 +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=AE1o9GzylDTNU/tj+neWnduRfzORtFIhqRzpNenF16s=; b=KQQwjHXjhIjWi0n/DRsUXXaUSZ lz/F9cKMvXdFRyDwpoT/3UzQqYkPnss2C6+l+AgKxqgS34vRpJIBpRX5oaA3MK/75bp/gZ1pvZnbg YJ0dXT1cJlgY13KrD1xnmtTp4pzA9o3Y+sf7/r/gInl1yvTmgOK+s/4j/8vYwBCfSgUH3bzY9/AUS UNlgajdNuf+Hc9v3YSeKp8NNWuKAH4DAyicqMiDRxi/wB37hB7rBKZI69R754L6LPDy/WA9MRV6sr /f13ANSyWZvSUG8dhhB0wqy/1YKjKLcwJrt4+QYwqpECyVXrzyk3PNSeKn3BaiITcMMqm8ZrnCgpX acSYuEgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFao-0000000FLcA-1CO0; Thu, 18 Jul 2024 01:05:58 +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 1sUFWF-0000000FJiU-2uXi for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 01:01:17 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-650ab31aabdso6016607b3.3 for ; Wed, 17 Jul 2024 18:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264474; x=1721869274; 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=AE1o9GzylDTNU/tj+neWnduRfzORtFIhqRzpNenF16s=; b=Yt3Zl+2J6U9ggu898PN4xg518AUMMQnA7B3Z1GaELDF706GU5eusde9d29ViJArdpi xbMuLZEXFVjnIBn8VOO1gaEWt8KSMeRF1HryVOiNql3acXHeQ0FWg0HfHah6iDfM2Ifn ffYm1sjbVjYrQNTQSE/Ctmri4FgUXJiGxdn7PMvrgw+v6cwJaNLGrDIQvED88GF24DJv wZsxSLJGvzbkBcskcHeOuTZ1IgXdoeODllUp+IaM3n9vxN/K6U9sDrQWPLy13dt5ieqZ A2OgJxH/WhdCg6KXS6RwOTGsxKlKDMoiDV9WA7yHJtAwfOL4DxX8wdyfFBc+V7kKwvDA FMew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264474; x=1721869274; 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=AE1o9GzylDTNU/tj+neWnduRfzORtFIhqRzpNenF16s=; b=QtEeePm3wccyb5LJZAVte5a5uUx4Eu+ojeWy3G0ddzmDQqFivulm5yF75U/JLxXK9n xG9QA3jOF+Kf1Vl9tOKWKdL7+RI3wAgeWuyh//2fvCL56opqtrmv2Jaf8XBUVXOQ6JwY GP4qDtjX2XY/LUpLqCRcMGEP9M3BaDvD2BRi2snFhlXPIU1HLH2OqgVTZ5yPwWrEUbZ+ qRb2+KF5IPy9yakCa5H3XrYwglpi6cpzSsiOzH+SSh9+dcQdaCTPT9zxpvyMpC6reFVC j1xOe5WCTDGyOnvrdw7hZ5BVFXjPgfUr8MsYZjsJuFh+X7WUAz568dfA/8kbpItU41eO a5qQ== X-Forwarded-Encrypted: i=1; AJvYcCXlzcLzX84yYhZIsjm8FOzIo+MEGeZnEF9OQwYjE6T4IcvxUzoWgf6CNRLZ4d7t3knIjjvEB11DoSAFEh4S3gzbnaamm3F//TJ3OZDJ0ksQPCaTR7E= X-Gm-Message-State: AOJu0YwjNYpHJz9XRBaT/fs+pGkn2DfflI+JZbisNkTCDKNFL5NcT324 aQbW2FkvEQDIsdzDwPlsMzr4/sZHu4pyv6HKyY3RwecyO3SlRtTNZkndRphpsXH/2jQ5s07YSFE tv1e6QQ== X-Google-Smtp-Source: AGHT+IGgBhJ/vZuBVSyFSptR6UrX0xinXo4sb/hBXkBYSLP3hMqMO6tKzBxK9aNEcm7jyYNyXiyoQrcO72E7 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a05:6902:1245:b0:e03:a0dd:43c1 with SMTP id 3f1490d57ef6-e05fe74c656mr10367276.0.1721264473975; Wed, 17 Jul 2024 18:01:13 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:12 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-17-irogers@google.com> Mime-Version: 1.0 References: <20240718010023.1495687-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Subject: [PATCH v6 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-20240717_180115_798415_5F2511C8 X-CRM114-Status: GOOD ( 12.31 ) 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 Reviewed-by: Adrian Hunter --- 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);