[RFT PATCH v2 4/7] perf-x86: iostat: Change iostat_prefix() to static

Ian Rogers irogers at google.com
Thu May 7 08:39:01 PDT 2026


On Wed, May 6, 2026 at 11:37 PM Yushan Wang <wangyushan12 at huawei.com> wrote:
>
> Change iostat_prefix() to static function, since it is not used outside.
>
> Signed-off-by: Yushan Wang <wangyushan12 at huawei.com>

Reviewed-by: Ian Rogers <irogers at google.com>

> ---
>  tools/perf/util/iostat.c     |  7 ------
>  tools/perf/util/iostat.h     |  2 --
>  tools/perf/util/x86-iostat.c | 44 ++++++++++++++++++------------------
>  3 files changed, 22 insertions(+), 31 deletions(-)
>
> diff --git a/tools/perf/util/iostat.c b/tools/perf/util/iostat.c
> index b770bd473af7..a68ab100780d 100644
> --- a/tools/perf/util/iostat.c
> +++ b/tools/perf/util/iostat.c
> @@ -37,13 +37,6 @@ __weak void iostat_print_metric(struct perf_stat_config *config __maybe_unused,
>  {
>  }
>
> -__weak void iostat_prefix(struct evlist *evlist __maybe_unused,
> -                         struct perf_stat_config *config __maybe_unused,
> -                         char *prefix __maybe_unused,
> -                         struct timespec *ts __maybe_unused)
> -{
> -}
> -
>  __weak void iostat_print_counters(struct evlist *evlist __maybe_unused,
>                                   struct perf_stat_config *config __maybe_unused,
>                                   struct timespec *ts __maybe_unused,

This change doesn't remove the weak symbols, but they should go. We
should use the ELF machine to determine which architecture version to
use.

Thanks,
Ian

> diff --git a/tools/perf/util/iostat.h b/tools/perf/util/iostat.h
> index a4e7299c5c2f..820930a096d9 100644
> --- a/tools/perf/util/iostat.h
> +++ b/tools/perf/util/iostat.h
> @@ -35,8 +35,6 @@ int iostat_parse(const struct option *opt, const char *str,
>                  int unset __maybe_unused);
>  void iostat_list(struct evlist *evlist, struct perf_stat_config *config);
>  void iostat_release(struct evlist *evlist);
> -void iostat_prefix(struct evlist *evlist, struct perf_stat_config *config,
> -                  char *prefix, struct timespec *ts);
>  void iostat_print_header_prefix(struct perf_stat_config *config);
>  void iostat_print_metric(struct perf_stat_config *config, struct evsel *evsel,
>                          struct perf_stat_output_ctx *out);
> diff --git a/tools/perf/util/x86-iostat.c b/tools/perf/util/x86-iostat.c
> index 7442a2cd87ed..f8d4c9718594 100644
> --- a/tools/perf/util/x86-iostat.c
> +++ b/tools/perf/util/x86-iostat.c
> @@ -332,6 +332,28 @@ static int iostat_event_group(struct evlist *evl,
>         return ret;
>  }
>
> +static void iostat_prefix(struct evlist *evlist,
> +                         struct perf_stat_config *config,
> +                         char *prefix, struct timespec *ts)
> +{
> +       struct iio_root_port *rp = evlist->selected->priv;
> +
> +       if (rp) {
> +               /*
> +                * TODO: This is the incorrect format in JSON mode.
> +                *       See prepare_timestamp()
> +                */
> +               if (ts)
> +                       sprintf(prefix, "%6lu.%09lu%s%04x:%02x%s",
> +                               ts->tv_sec, ts->tv_nsec,
> +                               config->csv_sep, rp->domain, rp->bus,
> +                               config->csv_sep);
> +               else
> +                       sprintf(prefix, "%04x:%02x%s", rp->domain, rp->bus,
> +                               config->csv_sep);
> +       }
> +}
> +
>  int iostat_prepare(struct evlist *evlist, struct perf_stat_config *config)
>  {
>         if (evlist->core.nr_entries > 0) {
> @@ -396,28 +418,6 @@ void iostat_release(struct evlist *evlist)
>         }
>  }
>
> -void iostat_prefix(struct evlist *evlist,
> -                  struct perf_stat_config *config,
> -                  char *prefix, struct timespec *ts)
> -{
> -       struct iio_root_port *rp = evlist->selected->priv;
> -
> -       if (rp) {
> -               /*
> -                * TODO: This is the incorrect format in JSON mode.
> -                *       See prepare_timestamp()
> -                */
> -               if (ts)
> -                       sprintf(prefix, "%6lu.%09lu%s%04x:%02x%s",
> -                               ts->tv_sec, ts->tv_nsec,
> -                               config->csv_sep, rp->domain, rp->bus,
> -                               config->csv_sep);
> -               else
> -                       sprintf(prefix, "%04x:%02x%s", rp->domain, rp->bus,
> -                               config->csv_sep);
> -       }
> -}
> -
>  void iostat_print_header_prefix(struct perf_stat_config *config)
>  {
>         if (config->csv_output)
> --
> 2.33.0
>



More information about the linux-arm-kernel mailing list