From patchwork Fri Jul 12 18:10:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732152 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 65DEDC2BD09 for ; Fri, 12 Jul 2024 18:17:35 +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=ZfGB4qYIWwtakjvzGQZNS3+imagxPcgxRVJoCFymO4s=; b=VSxEh5ybQpAiPj2dvyvJUOjg7p VwjJdixESEITd2F+KXH/MnxHG4s07rh2e7zICc2TpkuwuDBrINSufTgS/IEcRJo7wxepMFN1yDE5Z m4xj8rQ4ZaRuhLk1pLb6CPnXQSTlBoscuMSHvnBrXwtsS8XdsozNvF0osXzuoR5ZwhNNWAsjxXYdT REvPp8ePILgJatRoOl8BF/eV5lKia6ygrA4ZEChckHwzPZ4BEkqO5gBXA701vKtk8WZ6zcHq5IdtC Pkz3wi4C0rFno7NweQp09b6ILMr+28jemcAqcHlVxxlTtvtOxpCllhzZRVIjGA3j/oMbifILJb6k1 W+92dCBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKpf-00000000xUt-1lIN; Fri, 12 Jul 2024 18:17:23 +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 1sSKlH-00000000vVX-0YFG for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:12:52 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-653306993a8so37564327b3.1 for ; Fri, 12 Jul 2024 11:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807970; x=1721412770; 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=ZfGB4qYIWwtakjvzGQZNS3+imagxPcgxRVJoCFymO4s=; b=1DmghxBYvLzTdXSwlaNJQ0CG00TATOBxwKvQBtKZW5gR1jCSqgjJ3UKic6PhQZMGUN OtK8p3Jz5bD2kgqwtCVPwEEKvU6Pd5+4gfQA4EkKZ0Sm9Yici9nGzP0seUpgfFPF1Gry MTm9gnC9McMVlANqnjRCb4sn0weP6WsWKmJLYTnBsEernt+Cp4xHxeyUci3tKpTEyGBi P26jnXzT3C0LFp5EduKj2EpG+SuFqhBJzb4cnz1kyhcOmU6dc+npU42jkX15B1nS4DF2 sLC8rBWvgt1VBrEINgACoLqm3VE0UUKV7Pt4Mei+B4aqNnBvVYq8xJ3n9guSZ16Dh88C aA9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807970; x=1721412770; 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=ZfGB4qYIWwtakjvzGQZNS3+imagxPcgxRVJoCFymO4s=; b=aXnFogqUpNWkNCy5et4I+9A7CrWuz+SJhakEhRtSqHODkGyED7Yye/SqNGCafoeQjm 28ccDx8IR+v4fGKNPqX6ZIJ4SIS0ZZ3F3KYYC6pSu/G8KJV0l+TR8/GWZ+3FV6VwFBPr tz8nQq+aNX/TcekLtRKnd5mGjtHHHSYLoEMW7bYigHtIV1kQgOBnbMScMgjHzfuYa8Jk QYe2aeJ1x64dt2gdk06HkQ9t74GuJ5OIQlHCQYSmDtrhsrPTpic4p0pvYgGl//AkjcpL tMkaeGftdrmOwuAdZ4kASiZRdMY3+BZZMqk5Yc7U0fb99I19wpz0IJI+P7S0Yrm6cG8m NXYA== X-Forwarded-Encrypted: i=1; AJvYcCVZ7jly+Jd52qw/zS1tqhzPdrM259gzncLbN3Jg7j5+m7onSg31ThhIIAohEXPr0JFLYsHgLhbdWkvoGf7mwFJ4TqeJ6fDqiVaMMVihgtVbV6FZxhs= X-Gm-Message-State: AOJu0YxS5oUqbY+lralsiiG1U3XfiWbdGbHnZBvVRZ9peQJ/tKNseP/G Y0nUaKVjKBoxTTAiKDG1uQ90MEnUOpwDrxchgwQTqmUNoaXupt8NCyzAXXWclQsoynt0p92+aGt WQC9nYw== X-Google-Smtp-Source: AGHT+IGwm97iX/hGe03hY3o8dBT3RVSvlUNVeKVGrABZ6gQou1GSxK9awtmr+31vBv1Cj2NXc9MdjmjFPQQ1 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:690c:fc4:b0:61b:e103:804d with SMTP id 00721157ae682-658ebbb801cmr734427b3.0.1720807969781; Fri, 12 Jul 2024 11:12:49 -0700 (PDT) Date: Fri, 12 Jul 2024 11:10:59 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-19-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 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-20240712_111251_197216_9141FB76 X-CRM114-Status: GOOD ( 12.29 ) 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)