]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf tools: Make more global variables static
authorIan Rogers <irogers@google.com>
Wed, 8 Apr 2026 17:31:58 +0000 (14:31 -0300)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 9 Apr 2026 02:21:04 +0000 (19:21 -0700)
`make check` will run sparse on the perf code base. A frequent warning
is "warning: symbol '...' was not declared. Should it be static?" Go
through and make global definitions without declarations static.

In some cases it is deliberate due to dlsym accessing the symbol, this
change doesn't clean up the missing declarations for perf test suites.

Sometimes things can opportunistically be made const.

Making somethings static exposed unused functions warnings, so
restructuring of ifdefs was necessary for that.

These changes reduce the size of the perf binary by 568 bytes.

Committer notes:

Refreshed the patch, the original one fell thru the cracks, updated the
size reduction.

Remove the trace-event-scripting.c changes, break the build, noticed
with container builds and with sashiko:

  https://sashiko.dev/#/patchset/20260401215306.2152898-1-acme%40kernel.org

Also make two variables static to address another sashiko review
comment:

  https://sashiko.dev/#/patchset/20260402001740.2220481-1-acme%40kernel.org

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Ankur Arora <ankur.a.arora@oracle.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yujie Liu <yujie.liu@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
24 files changed:
tools/perf/arch/common.c
tools/perf/arch/sh/include/dwarf-regs-table.h
tools/perf/bench/breakpoint.c
tools/perf/bench/mem-functions.c
tools/perf/bench/numa.c
tools/perf/bench/uprobe.c
tools/perf/builtin-c2c.c
tools/perf/builtin-config.c
tools/perf/builtin-data.c
tools/perf/builtin-diff.c
tools/perf/builtin-kmem.c
tools/perf/builtin-kwork.c
tools/perf/builtin-script.c
tools/perf/builtin-top.c
tools/perf/tests/bp_signal.c
tools/perf/tests/dso-data.c
tools/perf/tests/wp.c
tools/perf/util/block-range.c
tools/perf/util/bpf_counter.c
tools/perf/util/bpf_off_cpu.c
tools/perf/util/debug.c
tools/perf/util/debuginfo.c
tools/perf/util/sort.c
tools/perf/util/util.c

index 4908d54dd33b27337c64fdae452893bdd31b133e..21836f70f231e42da688c2485cd4674294404bb7 100644 (file)
@@ -9,14 +9,14 @@
 #include "../util/debug.h"
 #include <linux/zalloc.h>
 
-const char *const arc_triplets[] = {
+static const char *const arc_triplets[] = {
        "arc-linux-",
        "arc-snps-linux-uclibc-",
        "arc-snps-linux-gnu-",
        NULL
 };
 
-const char *const arm_triplets[] = {
+static const char *const arm_triplets[] = {
        "arm-eabi-",
        "arm-linux-androideabi-",
        "arm-unknown-linux-",
@@ -28,13 +28,13 @@ const char *const arm_triplets[] = {
        NULL
 };
 
-const char *const arm64_triplets[] = {
+static const char *const arm64_triplets[] = {
        "aarch64-linux-android-",
        "aarch64-linux-gnu-",
        NULL
 };
 
-const char *const powerpc_triplets[] = {
+static const char *const powerpc_triplets[] = {
        "powerpc-unknown-linux-gnu-",
        "powerpc-linux-gnu-",
        "powerpc64-unknown-linux-gnu-",
@@ -43,40 +43,40 @@ const char *const powerpc_triplets[] = {
        NULL
 };
 
-const char *const riscv32_triplets[] = {
+static const char *const riscv32_triplets[] = {
        "riscv32-unknown-linux-gnu-",
        "riscv32-linux-android-",
        "riscv32-linux-gnu-",
        NULL
 };
 
-const char *const riscv64_triplets[] = {
+static const char *const riscv64_triplets[] = {
        "riscv64-unknown-linux-gnu-",
        "riscv64-linux-android-",
        "riscv64-linux-gnu-",
        NULL
 };
 
-const char *const s390_triplets[] = {
+static const char *const s390_triplets[] = {
        "s390-ibm-linux-",
        "s390x-linux-gnu-",
        NULL
 };
 
-const char *const sh_triplets[] = {
+static const char *const sh_triplets[] = {
        "sh-unknown-linux-gnu-",
        "sh-linux-gnu-",
        NULL
 };
 
-const char *const sparc_triplets[] = {
+static const char *const sparc_triplets[] = {
        "sparc-unknown-linux-gnu-",
        "sparc64-unknown-linux-gnu-",
        "sparc64-linux-gnu-",
        NULL
 };
 
-const char *const x86_triplets[] = {
+static const char *const x86_triplets[] = {
        "x86_64-pc-linux-gnu-",
        "x86_64-unknown-linux-gnu-",
        "i686-pc-linux-gnu-",
@@ -90,7 +90,7 @@ const char *const x86_triplets[] = {
        NULL
 };
 
-const char *const mips_triplets[] = {
+static const char *const mips_triplets[] = {
        "mips-unknown-linux-gnu-",
        "mipsel-linux-android-",
        "mips-linux-gnu-",
index 900e6961997091c737b57e85b834349cdfcc6248..b5974a090fb44a7965e8f71a04a7f0c0dc13022a 100644 (file)
@@ -2,7 +2,7 @@
 #ifdef DEFINE_DWARF_REGSTR_TABLE
 /* This is included in perf/util/dwarf-regs.c */
 
-const char * const sh_regstr_tbl[] = {
+static const char * const sh_regstr_tbl[] = {
        "r0",
        "r1",
        "r2",
index dfd18f5db97dbc7ef1476faa6097f3aa5cdf46ad..1b7cd4481bd224aa200b2ad95362ff3264d1f98a 100644 (file)
@@ -16,7 +16,7 @@
 #include "bench.h"
 #include "futex.h"
 
-struct {
+static struct {
        unsigned int nbreakpoints;
        unsigned int nparallel;
        unsigned int nthreads;
@@ -173,7 +173,7 @@ int bench_breakpoint_thread(int argc, const char **argv)
        return 0;
 }
 
-struct {
+static struct {
        unsigned int npassive;
        unsigned int nactive;
 } enable_params = {
index f5ab41bb85bf67a0f70f2d493cfe1d64271c92a5..5ede528539535b6ae7442d06dd2ff91888319489 100644 (file)
@@ -399,7 +399,7 @@ static void mem_free(struct bench_mem_info *info __maybe_unused,
        *dst = *src = NULL;
 }
 
-struct function memcpy_functions[] = {
+static struct function memcpy_functions[] = {
        { .name         = "default",
          .desc         = "Default memcpy() provided by glibc",
          .fn.init      = mem_alloc,
index 19be2aaf4dc0c07ebe251a9be2b294b3c41681b8..6588a9b0b15aec6dca22a108f8143def50aab332 100644 (file)
@@ -166,7 +166,7 @@ static struct global_info   *g = NULL;
 static int parse_cpus_opt(const struct option *opt, const char *arg, int unset);
 static int parse_nodes_opt(const struct option *opt, const char *arg, int unset);
 
-struct params p0;
+static struct params p0;
 
 static const struct option options[] = {
        OPT_INTEGER('p', "nr_proc"      , &p0.nr_proc,          "number of processes"),
index c4dac868f1eea401aaf08c98b02db2eebc60a0ce..89697ff788ef303589bb0424b07b6573c0d6d31a 100644 (file)
@@ -58,7 +58,7 @@ static const char * const bench_uprobe_usage[] = {
                goto cleanup; \
        }
 
-struct bench_uprobe_bpf *skel;
+static struct bench_uprobe_bpf *skel;
 
 static int bench_uprobe__setup_bpf_skel(enum bench_uprobe bench)
 {
index e60eea62c2fc76d66c07c5851672c13056fc1d7e..3ce5f0adec2f31c21c106391e6a816fd4ad2cfc0 100644 (file)
@@ -2892,9 +2892,10 @@ static int ui_quirks(void)
 
 #define CALLCHAIN_DEFAULT_OPT  "graph,0.5,caller,function,percent"
 
-const char callchain_help[] = "Display call graph (stack chain/backtrace):\n\n"
-                               CALLCHAIN_REPORT_HELP
-                               "\n\t\t\t\tDefault: " CALLCHAIN_DEFAULT_OPT;
+static const char callchain_help[] =
+       "Display call graph (stack chain/backtrace):\n\n"
+       CALLCHAIN_REPORT_HELP
+       "\n\t\t\t\tDefault: " CALLCHAIN_DEFAULT_OPT;
 
 static int
 parse_callchain_opt(const struct option *opt, const char *arg, int unset)
index 45b5312fbe8370e84986a8f0ab8641fc1a4eec6d..237600643bbd6f33b3d1c7c821fae236306b0b34 100644 (file)
@@ -23,7 +23,7 @@ static const char * const config_usage[] = {
        NULL
 };
 
-enum actions {
+static enum actions {
        ACTION_LIST = 1
 } actions;
 
index 85f59886b5cf0045b5a33236f0f2cea9add8e65f..4c08ccb8c06b7598e7c15229826a7fc2cb1f8cf5 100644 (file)
@@ -28,15 +28,15 @@ static const char *data_usage[] = {
        NULL
 };
 
-const char *to_json;
-const char *to_ctf;
-struct perf_data_convert_opts opts = {
+static const char *to_json;
+static const char *to_ctf;
+static struct perf_data_convert_opts opts = {
        .force = false,
        .all = false,
        .time_str = NULL,
 };
 
-const struct option data_options[] = {
+static const struct option data_options[] = {
                OPT_INCR('v', "verbose", &verbose, "be more verbose"),
                OPT_STRING('i', "input", &input_name, "file", "input file name"),
                OPT_STRING(0, "to-json", &to_json, NULL, "Convert to JSON format"),
index 35d599d5c9fa06a1566b75d2c021deb1150e8c91..2c59e43901fe54254ec603517991452897d8abb0 100644 (file)
@@ -113,7 +113,7 @@ enum {
        COMPUTE_STREAM, /* After COMPUTE_MAX to avoid use current compute arrays */
 };
 
-const char *compute_names[COMPUTE_MAX] = {
+static const char *compute_names[COMPUTE_MAX] = {
        [COMPUTE_DELTA] = "delta",
        [COMPUTE_DELTA_ABS] = "delta-abs",
        [COMPUTE_RATIO] = "ratio",
@@ -382,7 +382,7 @@ static void block_hist_free(void *he)
        free(bh);
 }
 
-struct hist_entry_ops block_hist_ops = {
+static struct hist_entry_ops block_hist_ops = {
        .new    = block_hist_zalloc,
        .free   = block_hist_free,
 };
index 7929a5fa5f462b32f1b46c9b7088808915cba092..9c64a0d7482378cc2fe2f7081a00a8ab91e2fa4f 100644 (file)
@@ -82,7 +82,7 @@ static unsigned long nr_allocs, nr_cross_allocs;
 
 /* filters for controlling start and stop of time of analysis */
 static struct perf_time_interval ptime;
-const char *time_str;
+static const char *time_str;
 
 static int insert_alloc_stat(unsigned long call_site, unsigned long ptr,
                             int bytes_req, int bytes_alloc, int cpu)
index 6f94a8f45f605f343e448fc886c287d6bf1aeb6f..1140e00e874f4eed424ef533b367e5d962a9c14b 100644 (file)
@@ -985,7 +985,7 @@ static int process_irq_handler_exit_event(const struct perf_tool *tool,
        return 0;
 }
 
-const struct evsel_str_handler irq_tp_handlers[] = {
+static const struct evsel_str_handler irq_tp_handlers[] = {
        { "irq:irq_handler_entry", process_irq_handler_entry_event, },
        { "irq:irq_handler_exit",  process_irq_handler_exit_event,  },
 };
@@ -1080,7 +1080,7 @@ static int process_softirq_exit_event(const struct perf_tool *tool,
        return 0;
 }
 
-const struct evsel_str_handler softirq_tp_handlers[] = {
+static const struct evsel_str_handler softirq_tp_handlers[] = {
        { "irq:softirq_raise", process_softirq_raise_event, },
        { "irq:softirq_entry", process_softirq_entry_event, },
        { "irq:softirq_exit",  process_softirq_exit_event,  },
@@ -1211,7 +1211,7 @@ static int process_workqueue_execute_end_event(const struct perf_tool *tool,
        return 0;
 }
 
-const struct evsel_str_handler workqueue_tp_handlers[] = {
+static const struct evsel_str_handler workqueue_tp_handlers[] = {
        { "workqueue:workqueue_activate_work", process_workqueue_activate_work_event, },
        { "workqueue:workqueue_execute_start", process_workqueue_execute_start_event, },
        { "workqueue:workqueue_execute_end",   process_workqueue_execute_end_event,   },
@@ -1281,7 +1281,7 @@ static int process_sched_switch_event(const struct perf_tool *tool,
        return 0;
 }
 
-const struct evsel_str_handler sched_tp_handlers[] = {
+static const struct evsel_str_handler sched_tp_handlers[] = {
        { "sched:sched_switch",  process_sched_switch_event, },
 };
 
@@ -1561,13 +1561,13 @@ static void print_bad_events(struct perf_kwork *kwork)
        }
 }
 
-const char *graph_load = "||||||||||||||||||||||||||||||||||||||||||||||||";
-const char *graph_idle = "                                                ";
 static void top_print_per_cpu_load(struct perf_kwork *kwork)
 {
        int i, load_width;
        u64 total, load, load_ratio;
        struct kwork_top_stat *stat = &kwork->top_stat;
+       const char *graph_load = "||||||||||||||||||||||||||||||||||||||||||||||||";
+       const char *graph_idle = "                                                ";
 
        for (i = 0; i < MAX_NR_CPUS; i++) {
                total = stat->cpus_runtime[i].total;
index 42d4cc1620397b9f2afa3b529f730cc97e68ff4d..43ce119dac3ed9f9fb7b214ec74ccf0f33f0e7a3 100644 (file)
@@ -166,7 +166,7 @@ struct perf_script {
        int                     range_num;
 };
 
-struct output_option {
+static struct output_option {
        const char *str;
        enum perf_output_field field;
 } all_output_options[] = {
index 37950efb28aca8ccea0be1c2e3f65fc69eff1aff..f6eb543de537a3d34240e5a7fd229aace075d0bf 100644 (file)
@@ -1449,11 +1449,10 @@ parse_percent_limit(const struct option *opt, const char *arg,
        return 0;
 }
 
-const char top_callchain_help[] = CALLCHAIN_RECORD_HELP CALLCHAIN_REPORT_HELP
-       "\n\t\t\t\tDefault: fp,graph,0.5,caller,function";
-
 int cmd_top(int argc, const char **argv)
 {
+       static const char top_callchain_help[] = CALLCHAIN_RECORD_HELP CALLCHAIN_REPORT_HELP
+               "\n\t\t\t\tDefault: fp,graph,0.5,caller,function";
        char errbuf[BUFSIZ];
        struct perf_top top = {
                .count_filter        = 5,
index 3faeb5b6fe0bb24a9d5d669e85a2d8f7fca0e2d3..f580ba7486b1d8ab25866d23b028a36cf570404a 100644 (file)
@@ -36,7 +36,7 @@ static int fd3;
 static int overflows;
 static int overflows_2;
 
-volatile long the_var;
+static volatile long the_var;
 
 
 /*
index a1fff4203b75f66548beaa76551946c569a1c45e..46bc3f59726004fa2073cd6a0685d3dca0becc35 100644 (file)
@@ -58,7 +58,7 @@ struct test_data_offset {
        int size;
 };
 
-struct test_data_offset offsets[] = {
+static struct test_data_offset offsets[] = {
        /* Fill first cache page. */
        {
                .offset = 10,
index 6c178985e37f5ebae2869a60f4c1bf29fc8c1049..69b31f00eed04c5bb2758ece50d541a33455d9e4 100644 (file)
@@ -22,11 +22,11 @@ do {                                            \
 
 #ifdef __i386__
 /* Only breakpoint length less-than 8 has hardware support on i386. */
-volatile u32 data1;
+static volatile u32 data1;
 #else
-volatile u64 data1;
+static volatile u64 data1;
 #endif
-volatile u8 data2[3];
+static volatile u8 data2[3];
 
 #ifndef __s390x__
 static int wp_read(int fd, long long *count, int size)
index 15c42196c24c8230779b04c1ddd55e1d473deade..7c559fcfd7e0a6db44e6c657e6ab4d351851ecae 100644 (file)
@@ -4,7 +4,7 @@
 #include <assert.h>
 #include <stdlib.h>
 
-struct {
+static struct {
        struct rb_root root;
        u64 blocks;
 } block_ranges;
index 2ffd7aefb6eb3bf8dfc736019b562b0d56f57806..34b6b0da18b738c7984aee5eac2c30ab8082b4bd 100644 (file)
@@ -353,7 +353,7 @@ static int bpf_program_profiler__install_pe(struct evsel *evsel, int cpu_map_idx
        return 0;
 }
 
-struct bpf_counter_ops bpf_program_profiler_ops = {
+static struct bpf_counter_ops bpf_program_profiler_ops = {
        .load       = bpf_program_profiler__load,
        .enable     = bpf_program_profiler__enable,
        .disable    = bpf_program_profiler__disable,
@@ -833,7 +833,7 @@ static int bperf__destroy(struct evsel *evsel)
  * the leader prog.
  */
 
-struct bpf_counter_ops bperf_ops = {
+static struct bpf_counter_ops bperf_ops = {
        .load       = bperf__load,
        .enable     = bperf__enable,
        .disable    = bperf__disable,
index 0891d9c736609cfabee2e1cb51d51e61bf753fd9..a3b699a5322f1e51dedb804e761985a35cc4f48a 100644 (file)
@@ -39,7 +39,7 @@ union off_cpu_data {
        u64 array[1024 / sizeof(u64)];
 };
 
-u64 off_cpu_raw[MAX_STACKS + 5];
+static u64 off_cpu_raw[MAX_STACKS + 5];
 
 static int off_cpu_config(struct evlist *evlist)
 {
index 1dfa4d0eec4d7d5ac4be1c09cdb855efb2650e29..6b5ffe81f14121b7b02163285e8a2bf7e5bf215b 100644 (file)
@@ -48,7 +48,7 @@ int debug_ordered_events;
 static int redirect_to_stderr;
 int debug_data_convert;
 static FILE *_debug_file;
-bool debug_display_time;
+static bool debug_display_time;
 int debug_type_profile;
 
 FILE *debug_file(void)
index 4a559b3e8cdce60aa203323aa945cfeaef268f65..0e35c13abd041c4609941ffd29c5fe04d4deae64 100644 (file)
@@ -88,18 +88,17 @@ static struct debuginfo *__debuginfo__new(const char *path)
        return dbg;
 }
 
-enum dso_binary_type distro_dwarf_types[] = {
-       DSO_BINARY_TYPE__FEDORA_DEBUGINFO,
-       DSO_BINARY_TYPE__UBUNTU_DEBUGINFO,
-       DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
-       DSO_BINARY_TYPE__BUILDID_DEBUGINFO,
-       DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO,
-       DSO_BINARY_TYPE__NOT_FOUND,
-};
-
 struct debuginfo *debuginfo__new(const char *path)
 {
-       enum dso_binary_type *type;
+       static const enum dso_binary_type distro_dwarf_types[] = {
+               DSO_BINARY_TYPE__FEDORA_DEBUGINFO,
+               DSO_BINARY_TYPE__UBUNTU_DEBUGINFO,
+               DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
+               DSO_BINARY_TYPE__BUILDID_DEBUGINFO,
+               DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO,
+               DSO_BINARY_TYPE__NOT_FOUND,
+       };
+       const enum dso_binary_type *type;
        char buf[PATH_MAX], nil = '\0';
        struct dso *dso;
        struct debuginfo *dinfo = NULL;
index 5c9656cc4f9dacdb66351543c103ddd3cee6860a..6ce684d68bd61edba2df16806d8a8f18132617db 100644 (file)
@@ -44,11 +44,11 @@ regex_t             parent_regex;
 const char     default_parent_pattern[] = "^sys_|^do_page_fault";
 const char     *parent_pattern = default_parent_pattern;
 const char     *default_sort_order = "comm,dso,symbol";
-const char     default_branch_sort_order[] = "comm,dso_from,symbol_from,symbol_to,cycles";
+static const char      default_branch_sort_order[] = "comm,dso_from,symbol_from,symbol_to,cycles";
 const char     default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked,blocked,local_ins_lat,local_p_stage_cyc";
-const char     default_top_sort_order[] = "dso,symbol";
-const char     default_diff_sort_order[] = "dso,symbol";
-const char     default_tracepoint_sort_order[] = "trace";
+static const char      default_top_sort_order[] = "dso,symbol";
+static const char      default_diff_sort_order[] = "dso,symbol";
+static const char      default_tracepoint_sort_order[] = "trace";
 const char     *sort_order;
 const char     *field_order;
 regex_t                ignore_callees_regex;
@@ -173,7 +173,7 @@ static int hist_entry__tgid_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%7d:%-*.*s", tgid, width, width, comm ?: "");
 }
 
-struct sort_entry sort_tgid = {
+static struct sort_entry sort_tgid = {
        .se_header      = "   Tgid:Command",
        .se_cmp         = sort__tgid_cmp,
        .se_snprintf    = hist_entry__tgid_snprintf,
@@ -219,7 +219,7 @@ static int hist_entry__simd_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "[.] %s", name);
 }
 
-struct sort_entry sort_simd = {
+static struct sort_entry sort_simd = {
        .se_header      = "Simd   ",
        .se_cmp         = sort__simd_cmp,
        .se_snprintf    = hist_entry__simd_snprintf,
@@ -605,7 +605,7 @@ hist_entry__symoff_snprintf(struct hist_entry *he, char *bf, size_t size, unsign
        return repsep_snprintf(bf, size, "[%c] %s+0x%llx", he->level, sym->name, he->ip - sym->start);
 }
 
-struct sort_entry sort_sym_offset = {
+static struct sort_entry sort_sym_offset = {
        .se_header      = "Symbol Offset",
        .se_cmp         = sort__symoff_cmp,
        .se_sort        = sort__symoff_sort,
@@ -716,7 +716,7 @@ static int hist_entry__srcline_from_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*.*s", width, width, he->branch_info->srcline_from);
 }
 
-struct sort_entry sort_srcline_from = {
+static struct sort_entry sort_srcline_from = {
        .se_header      = "From Source:Line",
        .se_cmp         = sort__srcline_from_cmp,
        .se_collapse    = sort__srcline_from_collapse,
@@ -764,7 +764,7 @@ static int hist_entry__srcline_to_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*.*s", width, width, he->branch_info->srcline_to);
 }
 
-struct sort_entry sort_srcline_to = {
+static struct sort_entry sort_srcline_to = {
        .se_header      = "To Source:Line",
        .se_cmp         = sort__srcline_to_cmp,
        .se_collapse    = sort__srcline_to_collapse,
@@ -800,7 +800,7 @@ static int hist_entry__sym_ipc_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*s", width, tmp);
 }
 
-struct sort_entry sort_sym_ipc = {
+static struct sort_entry sort_sym_ipc = {
        .se_header      = "IPC   [IPC Coverage]",
        .se_cmp         = sort__sym_cmp,
        .se_snprintf    = hist_entry__sym_ipc_snprintf,
@@ -818,7 +818,7 @@ static int hist_entry__sym_ipc_null_snprintf(struct hist_entry *he
        return repsep_snprintf(bf, size, "%-*s", width, tmp);
 }
 
-struct sort_entry sort_sym_ipc_null = {
+static struct sort_entry sort_sym_ipc_null = {
        .se_header      = "IPC   [IPC Coverage]",
        .se_cmp         = sort__sym_cmp,
        .se_snprintf    = hist_entry__sym_ipc_null_snprintf,
@@ -851,7 +851,7 @@ static int hist_entry__callchain_branch_predicted_snprintf(
        return repsep_snprintf(bf, size, "%-*.*s", width, width, str);
 }
 
-struct sort_entry sort_callchain_branch_predicted = {
+static struct sort_entry sort_callchain_branch_predicted = {
        .se_header      = "Predicted",
        .se_cmp         = sort__callchain_branch_predicted_cmp,
        .se_snprintf    = hist_entry__callchain_branch_predicted_snprintf,
@@ -881,7 +881,7 @@ static int hist_entry__callchain_branch_abort_snprintf(struct hist_entry *he,
        return repsep_snprintf(bf, size, "%-*.*s", width, width, str);
 }
 
-struct sort_entry sort_callchain_branch_abort = {
+static struct sort_entry sort_callchain_branch_abort = {
        .se_header      = "Abort",
        .se_cmp         = sort__callchain_branch_abort_cmp,
        .se_snprintf    = hist_entry__callchain_branch_abort_snprintf,
@@ -914,7 +914,7 @@ static int hist_entry__callchain_branch_cycles_snprintf(struct hist_entry *he,
        return repsep_snprintf(bf, size, "%-*.*s", width, width, str);
 }
 
-struct sort_entry sort_callchain_branch_cycles = {
+static struct sort_entry sort_callchain_branch_cycles = {
        .se_header      = "Cycles",
        .se_cmp         = sort__callchain_branch_cycles_cmp,
        .se_snprintf    = hist_entry__callchain_branch_cycles_snprintf,
@@ -981,7 +981,7 @@ static int hist_entry__srcfile_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-.*s", width, he->srcfile);
 }
 
-struct sort_entry sort_srcfile = {
+static struct sort_entry sort_srcfile = {
        .se_header      = "Source File",
        .se_cmp         = sort__srcfile_cmp,
        .se_collapse    = sort__srcfile_collapse,
@@ -1033,7 +1033,7 @@ static int hist_entry__cpu_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%*.*d", width, width, he->cpu);
 }
 
-struct sort_entry sort_cpu = {
+static struct sort_entry sort_cpu = {
        .se_header      = "CPU",
        .se_cmp         = sort__cpu_cmp,
        .se_snprintf    = hist_entry__cpu_snprintf,
@@ -1064,7 +1064,7 @@ static int hist_entry__parallelism_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%*d", width, he->parallelism);
 }
 
-struct sort_entry sort_parallelism = {
+static struct sort_entry sort_parallelism = {
        .se_header      = "Parallelism",
        .se_cmp         = sort__parallelism_cmp,
        .se_filter      = hist_entry__parallelism_filter,
@@ -1105,7 +1105,7 @@ static int hist_entry__cgroup_id_snprintf(struct hist_entry *he,
                               he->cgroup_id.ino);
 }
 
-struct sort_entry sort_cgroup_id = {
+static struct sort_entry sort_cgroup_id = {
        .se_header      = "cgroup id (dev/inode)",
        .se_cmp         = sort__cgroup_id_cmp,
        .se_snprintf    = hist_entry__cgroup_id_snprintf,
@@ -1138,7 +1138,7 @@ static int hist_entry__cgroup_snprintf(struct hist_entry *he,
        return repsep_snprintf(bf, size, "%s", cgrp_name);
 }
 
-struct sort_entry sort_cgroup = {
+static struct sort_entry sort_cgroup = {
        .se_header      = "Cgroup",
        .se_cmp         = sort__cgroup_cmp,
        .se_snprintf    = hist_entry__cgroup_snprintf,
@@ -1169,7 +1169,7 @@ static int hist_entry__socket_filter(struct hist_entry *he, int type, const void
        return sk >= 0 && he->socket != sk;
 }
 
-struct sort_entry sort_socket = {
+static struct sort_entry sort_socket = {
        .se_header      = "Socket",
        .se_cmp         = sort__socket_cmp,
        .se_snprintf    = hist_entry__socket_snprintf,
@@ -1200,7 +1200,7 @@ static int hist_entry__time_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-.*s", width, he_time);
 }
 
-struct sort_entry sort_time = {
+static struct sort_entry sort_time = {
        .se_header      = "Time",
        .se_cmp         = sort__time_cmp,
        .se_snprintf    = hist_entry__time_snprintf,
@@ -1269,7 +1269,7 @@ static int hist_entry__trace_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-.*s", width, he->trace_output);
 }
 
-struct sort_entry sort_trace = {
+static struct sort_entry sort_trace = {
        .se_header      = "Trace output",
        .se_cmp         = sort__trace_cmp,
        .se_snprintf    = hist_entry__trace_snprintf,
@@ -1564,7 +1564,7 @@ sort__addr_to_cmp(struct hist_entry *left, struct hist_entry *right)
        return _sort__addr_cmp(to_l->addr, to_r->addr);
 }
 
-struct sort_entry sort_addr_from = {
+static struct sort_entry sort_addr_from = {
        .se_header      = "Source Address",
        .se_cmp         = sort__addr_from_cmp,
        .se_snprintf    = hist_entry__addr_from_snprintf,
@@ -1572,7 +1572,7 @@ struct sort_entry sort_addr_from = {
        .se_width_idx   = HISTC_ADDR_FROM,
 };
 
-struct sort_entry sort_addr_to = {
+static struct sort_entry sort_addr_to = {
        .se_header      = "Target Address",
        .se_cmp         = sort__addr_to_cmp,
        .se_snprintf    = hist_entry__addr_to_snprintf,
@@ -1629,7 +1629,7 @@ static int hist_entry__cycles_snprintf(struct hist_entry *he, char *bf,
                               he->branch_info->flags.cycles);
 }
 
-struct sort_entry sort_cycles = {
+static struct sort_entry sort_cycles = {
        .se_header      = "Basic Block Cycles",
        .se_cmp         = sort__cycles_cmp,
        .se_snprintf    = hist_entry__cycles_snprintf,
@@ -1919,7 +1919,7 @@ static int hist_entry__dcacheline_snprintf(struct hist_entry *he, char *bf,
        return _hist_entry__sym_snprintf(ms, addr, level, bf, size, width);
 }
 
-struct sort_entry sort_mispredict = {
+static struct sort_entry sort_mispredict = {
        .se_header      = "Branch Mispredicted",
        .se_cmp         = sort__mispredict_cmp,
        .se_snprintf    = hist_entry__mispredict_snprintf,
@@ -1938,7 +1938,7 @@ static int hist_entry__local_weight_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*llu", width, he->weight);
 }
 
-struct sort_entry sort_local_weight = {
+static struct sort_entry sort_local_weight = {
        .se_header      = "Local Weight",
        .se_cmp         = sort__weight_cmp,
        .se_snprintf    = hist_entry__local_weight_snprintf,
@@ -1952,7 +1952,7 @@ static int hist_entry__global_weight_snprintf(struct hist_entry *he, char *bf,
                               he->weight * he->stat.nr_events);
 }
 
-struct sort_entry sort_global_weight = {
+static struct sort_entry sort_global_weight = {
        .se_header      = "Weight",
        .se_cmp         = sort__weight_cmp,
        .se_snprintf    = hist_entry__global_weight_snprintf,
@@ -1971,7 +1971,7 @@ static int hist_entry__local_ins_lat_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*u", width, he->ins_lat);
 }
 
-struct sort_entry sort_local_ins_lat = {
+static struct sort_entry sort_local_ins_lat = {
        .se_header      = "Local INSTR Latency",
        .se_cmp         = sort__ins_lat_cmp,
        .se_snprintf    = hist_entry__local_ins_lat_snprintf,
@@ -1985,7 +1985,7 @@ static int hist_entry__global_ins_lat_snprintf(struct hist_entry *he, char *bf,
                               he->ins_lat * he->stat.nr_events);
 }
 
-struct sort_entry sort_global_ins_lat = {
+static struct sort_entry sort_global_ins_lat = {
        .se_header      = "INSTR Latency",
        .se_cmp         = sort__ins_lat_cmp,
        .se_snprintf    = hist_entry__global_ins_lat_snprintf,
@@ -2011,70 +2011,70 @@ static int hist_entry__p_stage_cyc_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*u", width, he->weight3);
 }
 
-struct sort_entry sort_local_p_stage_cyc = {
+static struct sort_entry sort_local_p_stage_cyc = {
        .se_header      = "Local Pipeline Stage Cycle",
        .se_cmp         = sort__p_stage_cyc_cmp,
        .se_snprintf    = hist_entry__p_stage_cyc_snprintf,
        .se_width_idx   = HISTC_LOCAL_P_STAGE_CYC,
 };
 
-struct sort_entry sort_global_p_stage_cyc = {
+static struct sort_entry sort_global_p_stage_cyc = {
        .se_header      = "Pipeline Stage Cycle",
        .se_cmp         = sort__p_stage_cyc_cmp,
        .se_snprintf    = hist_entry__global_p_stage_cyc_snprintf,
        .se_width_idx   = HISTC_GLOBAL_P_STAGE_CYC,
 };
 
-struct sort_entry sort_mem_daddr_sym = {
+static struct sort_entry sort_mem_daddr_sym = {
        .se_header      = "Data Symbol",
        .se_cmp         = sort__daddr_cmp,
        .se_snprintf    = hist_entry__daddr_snprintf,
        .se_width_idx   = HISTC_MEM_DADDR_SYMBOL,
 };
 
-struct sort_entry sort_mem_iaddr_sym = {
+static struct sort_entry sort_mem_iaddr_sym = {
        .se_header      = "Code Symbol",
        .se_cmp         = sort__iaddr_cmp,
        .se_snprintf    = hist_entry__iaddr_snprintf,
        .se_width_idx   = HISTC_MEM_IADDR_SYMBOL,
 };
 
-struct sort_entry sort_mem_daddr_dso = {
+static struct sort_entry sort_mem_daddr_dso = {
        .se_header      = "Data Object",
        .se_cmp         = sort__dso_daddr_cmp,
        .se_snprintf    = hist_entry__dso_daddr_snprintf,
        .se_width_idx   = HISTC_MEM_DADDR_DSO,
 };
 
-struct sort_entry sort_mem_locked = {
+static struct sort_entry sort_mem_locked = {
        .se_header      = "Locked",
        .se_cmp         = sort__locked_cmp,
        .se_snprintf    = hist_entry__locked_snprintf,
        .se_width_idx   = HISTC_MEM_LOCKED,
 };
 
-struct sort_entry sort_mem_tlb = {
+static struct sort_entry sort_mem_tlb = {
        .se_header      = "TLB access",
        .se_cmp         = sort__tlb_cmp,
        .se_snprintf    = hist_entry__tlb_snprintf,
        .se_width_idx   = HISTC_MEM_TLB,
 };
 
-struct sort_entry sort_mem_lvl = {
+static struct sort_entry sort_mem_lvl = {
        .se_header      = "Memory access",
        .se_cmp         = sort__lvl_cmp,
        .se_snprintf    = hist_entry__lvl_snprintf,
        .se_width_idx   = HISTC_MEM_LVL,
 };
 
-struct sort_entry sort_mem_snoop = {
+static struct sort_entry sort_mem_snoop = {
        .se_header      = "Snoop",
        .se_cmp         = sort__snoop_cmp,
        .se_snprintf    = hist_entry__snoop_snprintf,
        .se_width_idx   = HISTC_MEM_SNOOP,
 };
 
-struct sort_entry sort_mem_dcacheline = {
+static struct sort_entry sort_mem_dcacheline = {
        .se_header      = "Data Cacheline",
        .se_cmp         = sort__dcacheline_cmp,
        .se_snprintf    = hist_entry__dcacheline_snprintf,
@@ -2109,7 +2109,7 @@ static int hist_entry__blocked_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%.*s", width, out);
 }
 
-struct sort_entry sort_mem_blocked = {
+static struct sort_entry sort_mem_blocked = {
        .se_header      = "Blocked",
        .se_cmp         = sort__blocked_cmp,
        .se_snprintf    = hist_entry__blocked_snprintf,
@@ -2150,7 +2150,7 @@ static int hist_entry__phys_daddr_snprintf(struct hist_entry *he, char *bf,
        return width;
 }
 
-struct sort_entry sort_mem_phys_daddr = {
+static struct sort_entry sort_mem_phys_daddr = {
        .se_header      = "Data Physical Address",
        .se_cmp         = sort__phys_daddr_cmp,
        .se_snprintf    = hist_entry__phys_daddr_snprintf,
@@ -2179,7 +2179,7 @@ static int hist_entry__data_page_size_snprintf(struct hist_entry *he, char *bf,
                        get_page_size_name(mem_info__daddr(he->mem_info)->data_page_size, str));
 }
 
-struct sort_entry sort_mem_data_page_size = {
+static struct sort_entry sort_mem_data_page_size = {
        .se_header      = "Data Page Size",
        .se_cmp         = sort__data_page_size_cmp,
        .se_snprintf    = hist_entry__data_page_size_snprintf,
@@ -2204,7 +2204,7 @@ static int hist_entry__code_page_size_snprintf(struct hist_entry *he, char *bf,
                               get_page_size_name(he->code_page_size, str));
 }
 
-struct sort_entry sort_code_page_size = {
+static struct sort_entry sort_code_page_size = {
        .se_header      = "Code Page Size",
        .se_cmp         = sort__code_page_size_cmp,
        .se_snprintf    = hist_entry__code_page_size_snprintf,
@@ -2236,7 +2236,7 @@ static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*s", width, out);
 }
 
-struct sort_entry sort_abort = {
+static struct sort_entry sort_abort = {
        .se_header      = "Transaction abort",
        .se_cmp         = sort__abort_cmp,
        .se_snprintf    = hist_entry__abort_snprintf,
@@ -2268,7 +2268,7 @@ static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*s", width, out);
 }
 
-struct sort_entry sort_in_tx = {
+static struct sort_entry sort_in_tx = {
        .se_header      = "Branch in transaction",
        .se_cmp         = sort__in_tx_cmp,
        .se_snprintf    = hist_entry__in_tx_snprintf,
@@ -2340,7 +2340,7 @@ static int hist_entry__transaction_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-*s", width, buf);
 }
 
-struct sort_entry sort_transaction = {
+static struct sort_entry sort_transaction = {
        .se_header      = "Transaction                ",
        .se_cmp         = sort__transaction_cmp,
        .se_snprintf    = hist_entry__transaction_snprintf,
@@ -2379,7 +2379,7 @@ static int hist_entry__sym_size_snprintf(struct hist_entry *he, char *bf,
        return _hist_entry__sym_size_snprintf(he->ms.sym, bf, size, width);
 }
 
-struct sort_entry sort_sym_size = {
+static struct sort_entry sort_sym_size = {
        .se_header      = "Symbol size",
        .se_cmp         = sort__sym_size_cmp,
        .se_snprintf    = hist_entry__sym_size_snprintf,
@@ -2418,7 +2418,7 @@ static int hist_entry__dso_size_snprintf(struct hist_entry *he, char *bf,
        return _hist_entry__dso_size_snprintf(he->ms.map, bf, size, width);
 }
 
-struct sort_entry sort_dso_size = {
+static struct sort_entry sort_dso_size = {
        .se_header      = "DSO size",
        .se_cmp         = sort__dso_size_cmp,
        .se_snprintf    = hist_entry__dso_size_snprintf,
@@ -2455,7 +2455,7 @@ static int hist_entry__addr_snprintf(struct hist_entry *he, char *bf,
        return repsep_snprintf(bf, size, "%-#*llx", width, ip);
 }
 
-struct sort_entry sort_addr = {
+static struct sort_entry sort_addr = {
        .se_header      = "Address",
        .se_cmp         = sort__addr_cmp,
        .se_snprintf    = hist_entry__addr_snprintf,
@@ -2573,7 +2573,7 @@ static int hist_entry__typeoff_snprintf(struct hist_entry *he, char *bf,
                               he->mem_type_off, buf);
 }
 
-struct sort_entry sort_type_offset = {
+static struct sort_entry sort_type_offset = {
        .se_header      = "Data Type Offset",
        .se_cmp         = sort__type_cmp,
        .se_collapse    = sort__typeoff_sort,
@@ -2645,7 +2645,7 @@ static int hist_entry__typecln_snprintf(struct hist_entry *he, char *bf,
                               he->mem_type_off / cln_size);
 }
 
-struct sort_entry sort_type_cacheline = {
+static struct sort_entry sort_type_cacheline = {
        .se_header      = "Data Type Cacheline",
        .se_cmp         = sort__type_cmp,
        .se_collapse    = sort__typecln_sort,
index 8b893de35f777db05b5c0c14f179da1d1efb5109..c5fee8e394805544ca8230730b61937a9cacef89 100644 (file)
@@ -77,8 +77,6 @@ bool sysctl__nmi_watchdog_enabled(void)
        return nmi_watchdog;
 }
 
-bool test_attr__enabled;
-
 bool exclude_GH_default;
 
 bool perf_host  = true;