From patchwork Mon Apr 10 16:25:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13206514 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 2FAF1C76196 for ; Mon, 10 Apr 2023 16:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4yTmeLN1X9pEUlKtKCoQi1qE3iVu94fRj9ToSVdoWrg=; b=k3ws/UZCV3jHfy ZSA4rC6B/ZByieRWAMJfCUY2cRurt2OKrtKe3m3Vm+I8b2rELakE5SwmttMee3G1lN2LY6sN/Yt/0 GgATV+x6oEjR4oOiC2YZTLkZrJyPlbC4xjzAv6TMfWzx1GV6uKdlLAsIHcq3frPpDaCh5LoSwXc6/ YUYONWWDxzZ6Dt7C6p3IOzg0y9bx6KPkCe9ZuvUJl6nXjkvFHu0sInWqxX15Djgl68NZdwgugkZTV PHU/fPK7q8+0rd4Zjslo6+0fvr8N4Ank60wOPz9Q6mpEsPxKslcDoc/loKpxHo4tKBNRfW8jkK8+r 3AM9txMFfVlo7/TkGUBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pluLO-00FXcI-2C; Mon, 10 Apr 2023 16:26:14 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pluLM-00FXWR-0i for linux-arm-kernel@lists.infradead.org; Mon, 10 Apr 2023 16:26:13 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-54f1ffb8ccfso30334477b3.9 for ; Mon, 10 Apr 2023 09:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1681143971; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=Xp8qLxoPhgd5S79+sqfPyJ+NqpGI+WyWEYYgtfPYRjQ=; b=ZDRXwNY5e5FPtxB9zhgqLDyi3UwHdvrnISVCBcv0Bgsxi+Y+9o3obk/zEQGnouLpQk lyg90YffGBG8iuUJA+NxRopBoHNEPQcLCx6IlQ6+oxDBxTNmXdYmQHs74Y36H3BGGRwQ CGioOAduSeN83A/+TgLA/qDYxAWrXT79qsiZIUpHMFtCydZBQnjQClXUigmkOVblubwD 0/ipnMAxCOjXmYoGTCvqjGL9ojwjbbpjYxCWxW/9NilX4fFavuYQIUhzg5tO/9E3SGuw HhzkmZVTGgOEEH3nxxcvN11La1WnERbwiw/wG1813xqPRhdXAF+LurSOOcdY5INZ20Je jD2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681143971; 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=Xp8qLxoPhgd5S79+sqfPyJ+NqpGI+WyWEYYgtfPYRjQ=; b=HL7IprKP/Dlujc6oUmkelylCl/tv7/ed/IQo6bDvf8oVeSffUsX5Yj65oUgw8TrKid AojX4X2B3GpcgZcrrIlGFT0/tTorvsntw6/90yvfVYJGbGzWnxX0K3FEvyqg27aw2R7v RahxR3t3TsJx0OLMtqpN4tFQAG656IoiM5QSY1yrMxbDnBgr7g+5fKBQ2zGSGVtsFIp3 HPGe8AATZFiyDvA7B4oHBL5uUbqAsYIdnaXSKqqYSeqHfXsFJqubn71bCZnSzExiKj1s e8QQlRkjQAhZSZmTmIUBBskc7qbKju02C57Z/cMu4fs99AVAmuxehOZs4Q8uAfO1/4/X 4CLw== X-Gm-Message-State: AAQBX9czUT8HvB/tfrNUeftqyLp1KDwB4+1fGqXJdJ1tJhAtTFdjYBj1 +VZ5iCzw45Y5X940aURbrkvKBqQ9XMAr X-Google-Smtp-Source: AKy350aouxxZ7jU7zNe3eUUa4vRGvDHz2LG7vg0V6RtkPpSG3EqLqVAQ4jykf6wV2keZV3jykI2OBNNYZD2S X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:fc51:6a03:541d:a18d]) (user=irogers job=sendgmr) by 2002:a81:e401:0:b0:54c:19a6:480 with SMTP id r1-20020a81e401000000b0054c19a60480mr5951915ywl.4.1681143971215; Mon, 10 Apr 2023 09:26:11 -0700 (PDT) Date: Mon, 10 Apr 2023 09:25:10 -0700 In-Reply-To: <20230410162511.3055900-1-irogers@google.com> Message-Id: <20230410162511.3055900-6-irogers@google.com> Mime-Version: 1.0 References: <20230410162511.3055900-1-irogers@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Subject: [PATCH v2 5/6] perf util: Move input_name to util From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Mathieu Poirier , Suzuki K Poulose , Kan Liang , Raul Silvera , Athira Rajeev , Ravi Bangoria , Florian Fischer , Rob Herring , Xing Zhengjun , Sean Christopherson , Chengdong Li , Denis Nikitin , " =?utf-8?q?Martin_Li=C5=A1ka?= " , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230410_092612_260432_C6D831BB X-CRM114-Status: GOOD ( 16.16 ) 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 input_name is the name of the input perf.data file, it is used by data convert and ui code. Move it to util to make it more consistent with other global state. Signed-off-by: Ian Rogers --- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-buildid-list.c | 2 +- tools/perf/builtin-c2c.c | 2 +- tools/perf/builtin-data.c | 2 +- tools/perf/builtin-evlist.c | 2 +- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-kwork.c | 2 +- tools/perf/builtin-mem.c | 2 +- tools/perf/builtin-sched.c | 2 +- tools/perf/builtin-stat.c | 2 +- tools/perf/builtin-timechart.c | 2 +- tools/perf/perf.c | 1 - tools/perf/perf.h | 1 - tools/perf/ui/browsers/hists.c | 2 +- tools/perf/util/util.c | 2 ++ tools/perf/util/util.h | 2 ++ 16 files changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 63fd2080b803..63cdf6ea6f6d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -15,7 +15,6 @@ #include #include "util/symbol.h" -#include "perf.h" #include "util/debug.h" #include "util/evlist.h" @@ -36,6 +35,7 @@ #include "util/block-range.h" #include "util/map_symbol.h" #include "util/branch.h" +#include "util/util.h" #include #include diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index eea28cbcc0b7..c9037477865a 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c @@ -8,7 +8,6 @@ * Copyright (C) 2009, Arnaldo Carvalho de Melo */ #include "builtin.h" -#include "perf.h" #include "util/build-id.h" #include "util/debug.h" #include "util/dso.h" @@ -18,6 +17,7 @@ #include "util/session.h" #include "util/symbol.h" #include "util/data.h" +#include "util/util.h" #include #include #include diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index d3181fee4d3d..6c12f0865860 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -41,10 +41,10 @@ #include "symbol.h" #include "ui/ui.h" #include "ui/progress.h" -#include "../perf.h" #include "pmu.h" #include "pmu-hybrid.h" #include "string2.h" +#include "util/util.h" struct c2c_hists { struct hists hists; diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c index b2a9a3b7f68d..ce51cbf6dc97 100644 --- a/tools/perf/builtin-data.c +++ b/tools/perf/builtin-data.c @@ -3,10 +3,10 @@ #include #include #include "builtin.h" -#include "perf.h" #include "debug.h" #include #include "data-convert.h" +#include "util/util.h" typedef int (*data_cmd_fn_t)(int argc, const char **argv); diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c index b1076177c37f..7117656939e7 100644 --- a/tools/perf/builtin-evlist.c +++ b/tools/perf/builtin-evlist.c @@ -7,7 +7,6 @@ #include -#include "perf.h" #include "util/evlist.h" #include "util/evsel.h" #include "util/evsel_fprintf.h" @@ -18,6 +17,7 @@ #include "util/debug.h" #include #include "util/tool.h" +#include "util/util.h" static int process_header_feature(struct perf_session *session __maybe_unused, union perf_event *event __maybe_unused) diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index fcd2ef3bd3f5..2150eeced892 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 #include "builtin.h" -#include "perf.h" #include "util/dso.h" #include "util/evlist.h" @@ -24,6 +23,7 @@ #include "util/debug.h" #include "util/string2.h" +#include "util/util.h" #include #include diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c index dc59d75180d1..a9395c52b23b 100644 --- a/tools/perf/builtin-kwork.c +++ b/tools/perf/builtin-kwork.c @@ -6,7 +6,6 @@ */ #include "builtin.h" -#include "perf.h" #include "util/data.h" #include "util/evlist.h" @@ -20,6 +19,7 @@ #include "util/string2.h" #include "util/callchain.h" #include "util/evsel_fprintf.h" +#include "util/util.h" #include #include diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 1e27188b0de1..65465930ef8e 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -4,7 +4,6 @@ #include #include #include "builtin.h" -#include "perf.h" #include #include "util/auxtrace.h" @@ -22,6 +21,7 @@ #include "util/pmu-hybrid.h" #include "util/sample.h" #include "util/string2.h" +#include "util/util.h" #include #define MEM_OPERATION_LOAD 0x1 diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 86e18575c9be..96a0dceadeff 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 #include "builtin.h" -#include "perf.h" #include "perf-sys.h" #include "util/cpumap.h" @@ -27,6 +26,7 @@ #include "util/debug.h" #include "util/event.h" +#include "util/util.h" #include #include diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 38133afda7fc..341b660f5b8c 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -41,7 +41,6 @@ */ #include "builtin.h" -#include "perf.h" #include "util/cgroup.h" #include #include "util/parse-events.h" @@ -71,6 +70,7 @@ #include "util/bpf_counter.h" #include "util/iostat.h" #include "util/pmu-hybrid.h" +#include "util/util.h" #include "asm/bug.h" #include diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 6c629e7d370a..bce1cf896f9c 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -24,7 +24,6 @@ #include "util/thread.h" #include "util/callchain.h" -#include "perf.h" #include "util/header.h" #include #include @@ -37,6 +36,7 @@ #include "util/debug.h" #include "util/string2.h" #include "util/tracepoint.h" +#include "util/util.h" #include #include diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 441c354b8304..38cae4721583 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -40,7 +40,6 @@ #include static int use_pager = -1; -const char *input_name; struct cmd_struct { const char *cmd; diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 989eb17ec474..49e15e2be49e 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h @@ -8,7 +8,6 @@ #define MAX_NR_CPUS 2048 #endif -extern const char *input_name; extern bool perf_host, perf_guest; enum perf_affinity { diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 9f9f622325ae..ab70e5f5fad2 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -29,8 +29,8 @@ #include "../../util/top.h" #include "../../util/thread.h" #include "../../util/block-info.h" +#include "../../util/util.h" #include "../../arch/common.h" -#include "../../perf.h" #include "../browsers/hists.h" #include "../helpline.h" diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 089208b51e68..c1fd9ba6d697 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -28,6 +28,8 @@ * XXX We need to find a better place for these things... */ +const char *input_name; + bool perf_singlethreaded = true; void perf_set_singlethreaded(void) diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 5010abf9e01e..8bd515b67739 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -18,6 +18,8 @@ extern const char perf_usage_string[]; extern const char perf_more_info_string[]; +extern const char *input_name; + /* General helper functions */ void usage(const char *err) __noreturn; void die(const char *err, ...) __noreturn __printf(1, 2);