From patchwork Thu Jul 18 01:00:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13735909 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 ACA03C3DA60 for ; Thu, 18 Jul 2024 01:06:47 +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=sIDIj8ohh0nflT4KD3kHem3lEjHwYWuoIZyNVV8EfDA=; b=i5K6zdgsm3y8/dUVL/7DYL3X96 SNu/tlrQqwRygeg9eWbmrOYT68T7Mut6TyaIfAcWKytpM3Dx5a6eCzT6G3Q2QFBc5CVGvID5eGYi7 8SPVtPSbfyodQe+b9+b4MT7JJe80hKswi6CCDr8jCy2ysTIUs76miHKx0/R2FAh/qcHJJhNVMRuwK CQdjFzCyc526Uhd88qFWEe74a/7bPIxweyhZ4ekkcAyYs2/Qo/95q+O0vgJw1h5iLtcwqIQ74OM1e KAuWHLP2FWmfMs8i8FMjJYI+/dKjoMiO5cG8bUwkKOvcJmWuG5Z9/yrSlqFCgPZSqMBU5d0escmaS BXDeFwAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFbQ-0000000FLqj-0hDz; Thu, 18 Jul 2024 01:06:36 +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 1sUFWK-0000000FJl7-0Os1 for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 01:01:21 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-65b985bb059so6581237b3.2 for ; Wed, 17 Jul 2024 18:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264479; x=1721869279; 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=sIDIj8ohh0nflT4KD3kHem3lEjHwYWuoIZyNVV8EfDA=; b=GM94SiQVrFBgL5smHRQHa1o9hAd3cGtSmiCX1tjO0nKN20BtWIPxqDuJzCtnQrFAhP J7Xjek/aV6U2X0wmUsV36y1k2wdouS4RVP14kx6/GUbl9M6JyvEWWsgB99jHFCG37/zA 47oIfBCpQnYBATYdblLj3rTsbPwUPKOFeyKcWmaqcbSJuESpfqlKgvldti0402Aq4Exm 8EAGkQwl8dTY0pfTB8xdf61nYtRfBuNinIFyfcssxYEJOkaYe2wdpb4MelnWgso2Lvw6 auiC1YF2X+7vTnMz0UDbIzeebD4f+80zHG2qbGCqLyIzsqVvkFvvyDqErHAsDafjQ04X MjSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264479; x=1721869279; 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=sIDIj8ohh0nflT4KD3kHem3lEjHwYWuoIZyNVV8EfDA=; b=UTO9yIVUOqmE4dxxCEP6+4T3pBgoGxhBar6vmqa2928vn15a9MzUJIN/MiNZu2Fri5 UY3WhRGATdiOmr8PodZC+6a3l8is/UR7mOnJjhr0kWpXNG3CqGpjrVvvz8jRllPkqNqX DYQs0NTiExq7C4BochSV81wGUQOjCWDYC+U22aVOZ8J1XEtqRtW8DW0tufmtawZAXnqy zAKx72/rdgmmgB7+ahqUbYsxb8CoiErfceD4yjFypl9iDNpjCFa2ih+75r2PGM8z2/zH 9MVwuAZTNaAbGaPjf8wVVEzskuLNe9ddNx1MeiDhTQodNZHFJPXHBLzb2WkPuAIzFo7h E9Vg== X-Forwarded-Encrypted: i=1; AJvYcCUaGg1AD/GBT3c/nw64ZZ9gy+mbLMwzb0y6H2JJ9irnIMW/P10g9rOzfjMpM9Yj4n1egAL+dtGe6yxtTXnfiC1m9unZY6sTzIbkHrX9CeGbM0FH4Dc= X-Gm-Message-State: AOJu0YziGS251ldecHkMHyuyHCy7sN7jBGE1TEuIi46DIB1sFICGKA9c knPrjdCDGJeji9EC/INxXoEHu/dtI3wyafYQNnMr7iCCYQKPEBJqocmi2Zw3fhgaEbrj14wLFMA dDMpsiA== X-Google-Smtp-Source: AGHT+IE7eyYkV30IAuJJyVKolxf68gGRG23Ds+4kcgr2lLuAa9Klg1hxPx68W8tgqNMyLyGzarxdoaI7qyDF X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a05:6902:18c6:b0:e05:a890:5abb with SMTP id 3f1490d57ef6-e05fea8885bmr27243276.1.1721264478691; Wed, 17 Jul 2024 18:01:18 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:14 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-19-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 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-20240717_180120_168906_A754FA12 X-CRM114-Status: GOOD ( 11.40 ) 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-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)