From patchwork Mon Aug 12 20:47:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13761035 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 EE3C8C3DA7F for ; Mon, 12 Aug 2024 20:58:25 +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=Kpr+cu9QRMpy3TlpvKDVPMxM+YZp/esLhrg70XBtQYY=; b=E4i8b1ci4jF1dY1hLTqGg477kc ERfWTUM3Pk/f9tPadfeH5LQZvqpMUHVEHqVS0nhtycr8hLg5F/QR/0YA5t3bcg9gRsivOcTBD7IBD b4Hf1BQNWAsI0kOzmGQPhNDJKSm9oDSHVnG+Quxhwv7ZvVdPrUoTTwDK/VxVrjgdyvZX4yM42zFKb 7Vuk99yo7Ns0OjLV+u7DmklaeOu+KHbHIzVu6JyHIEiqC5sSrlHaw1/i5bk6POf4VpOQQV9BM9a8M JgGEFvdRYdqkpip52MlFUVFhcXjhK6wq0SobiwrW5skBmC5olYuyIXew0CQceOf6RERG70iISQjer O2rfvgIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdc7N-00000001Xw9-2ogU; Mon, 12 Aug 2024 20:58:17 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdbxX-00000001UiS-2TbW for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 20:48:09 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e0b7922ed63so8809631276.0 for ; Mon, 12 Aug 2024 13:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495686; x=1724100486; 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=Kpr+cu9QRMpy3TlpvKDVPMxM+YZp/esLhrg70XBtQYY=; b=KA2wijpKUi/tVRDW7azQ3IoubFemvFkcTerFQrUfEHugCUOptjecQFcYcAvdaEVJPL DJaaZjIQfUP9PdCg7HOGgElwti1HsRqc/iH13dosk1hPFtlhFfFhTgg427xLeOQIRicT kH39hRIivi88QSucwpCnxsMOP7H69KhMftEsfHJR3fFKftjxx/uIvNMGIsdQT7zgVh8c oVp9LGS5KPRqUFPK5wjlr4RtkZlr1NxbVrm+2RINFLJa0rXtUzHLJ7KlCFHr1xFOs/mT qT0Mon8uyJwSPyOxt42Sm+Yx+Q5ynnYAWrFug5omt320m8aK8EJjGWANQPzkDJFM77oq 9Lkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495686; x=1724100486; 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=Kpr+cu9QRMpy3TlpvKDVPMxM+YZp/esLhrg70XBtQYY=; b=BN2Zk7ixj7Gp3+WaWU3j7rQ0NK57bBmfVVKoW1E0RjDgiFCZcNmJtVdEzvvSmsCKpV agYYDJea/FQ2Zl9ELARmxLeRM7JEkXiNDHKlkSfbzKrj5f/S9jX/roR0tN9RjZueoUVn 26JZWEquoJ7vqIzqBw9XecZgoaie8pRqHjvQhsG9/hE+eZReXPdD3XRxsgM2I9Ax0H6v TSjt3bbhGsLnPlFv/Z32HTSPOEoyMMKbW/8EU8uTwdSYG7Jeyn2noxy/Tv0c675dRzRy Z5Kvi6qHR9vVviXma3uFcOwE6NhA49YI0Oul+720YriIBhzRN4e61pVLRtBa63J0GM5F Dm5w== X-Forwarded-Encrypted: i=1; AJvYcCXe62bZ48DmOM8e2WrdR7MJ9TGKAOqaZMyEmlkif6Q/b8r510zbLSOnJreV6oWbISsCQ+MgynTUEPYy+I1rfm3rjB0K/eaU/mxV67x4Upp8Pt1ILK8= X-Gm-Message-State: AOJu0Yx71Xp/YQVtxJ3D5KU9AKYweh/sxguzEb8ndOcySoaJX1CkCYGc qGJOMH17x97q6TZ08KpsVz1Je89xS4W/B3lz3fLohGMLRFLivpdpopYcOYWtMKwLuARTVCjxzH4 wnTjBXg== X-Google-Smtp-Source: AGHT+IEbmaQbF7ylO1nyDJgivkzHHy3Dhc+dF+2T8SKBziKDX+/728BYpHWLDYabb5WwkODPfpNU22Bg1vcQ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a25:abe9:0:b0:e03:5b06:6db2 with SMTP id 3f1490d57ef6-e113cd4619fmr2763276.3.1723495686242; Mon, 12 Aug 2024 13:48:06 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:10 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-19-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 18/27] perf sched: 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_134807_680606_0BF2E25B X-CRM114-Status: GOOD ( 12.76 ) 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-sched.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 2c60bd3a8149..34fe8e540c43 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -3100,7 +3100,6 @@ static int perf_sched__timehist(struct perf_sched *sched) sched->tool.tracing_data = perf_event__process_tracing_data; sched->tool.build_id = perf_event__process_build_id; - sched->tool.ordered_events = true; sched->tool.ordering_requires_timestamps = true; symbol_conf.use_callchain = sched->show_callchain; @@ -3605,14 +3604,6 @@ int cmd_sched(int argc, const char **argv) { static const char default_sort_order[] = "avg, max, switch, runtime"; struct perf_sched sched = { - .tool = { - .sample = perf_sched__process_tracepoint_sample, - .comm = perf_sched__process_comm, - .namespaces = perf_event__process_namespaces, - .lost = perf_event__process_lost, - .fork = perf_sched__process_fork_event, - .ordered_events = true, - }, .cmp_pid = LIST_HEAD_INIT(sched.cmp_pid), .sort_list = LIST_HEAD_INIT(sched.sort_list), .sort_order = default_sort_order, @@ -3733,6 +3724,13 @@ int cmd_sched(int argc, const char **argv) }; int ret; + perf_tool__init(&sched.tool, /*ordered_events=*/true); + sched.tool.sample = perf_sched__process_tracepoint_sample; + sched.tool.comm = perf_sched__process_comm; + sched.tool.namespaces = perf_event__process_namespaces; + sched.tool.lost = perf_event__process_lost; + sched.tool.fork = perf_sched__process_fork_event; + argc = parse_options_subcommand(argc, argv, sched_options, sched_subcommands, sched_usage, PARSE_OPT_STOP_AT_NON_OPTION); if (!argc)