From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: acme@kernel.org, ctshao@google.com, adrian.hunter@intel.com,
james.clark@linaro.org, jolsa@kernel.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
mingo@redhat.com, peterz@infradead.org
Subject: Re: [PATCH v4 01/14] perf stat: Introduce core generic print traversal engine and header stubs
Date: Thu, 16 Jul 2026 15:22:21 -0700 [thread overview]
Message-ID: <allZnbHwHtZhfn9Y@google.com> (raw)
In-Reply-To: <20260716070303.507066-2-irogers@google.com>
On Thu, Jul 16, 2026 at 12:02:50AM -0700, Ian Rogers wrote:
> This patch introduces the initial infrastructure for decoupling the perf
> stat printing API. It declares the struct perf_stat_print_callbacks
> interface and the core traversal driver perf_stat__print_cb() inside the
> newly created util/stat-print.h and util/stat-print.c files.
>
> The generic traversal driver perf_stat__print_cb() drive traversing the
> event lists across all supported cpu aggregation modes (global, die,
> socket, cache, cluster, core, thread, none). It implements the clean
> display filtering checks (perf_stat__skip_metric_event(), hybrid
> wildcard merges) and the basic metrics allowlist filter
> (is_basic_shadow_metric()) to keep formatting callbacks decoupled.
>
> This also introduces two format-agnostic shared helpers to centralize
> aggregation prefix formatting:
> - perf_stat__get_aggr_key(): resolves JSON key names.
> - perf_stat__get_aggr_id_char(): formats unified aggregation identifiers.
>
> Adds empty format-specific stubs (perf_stat__print_std, _csv, _json) to
> ensure that the new print files link and compile cleanly under
> util/Build, without affecting the legacy print path.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> Assisted-by: Antigravity:gemini-3.5-flash
> Acked-by: Chun-Tse Shao <ctshao@google.com>
> ---
> tools/perf/builtin-stat.c | 96 +++---
> tools/perf/util/Build | 4 +
> tools/perf/util/stat-display.c | 12 +-
> tools/perf/util/stat-print-csv.c | 13 +
> tools/perf/util/stat-print-json.c | 13 +
> tools/perf/util/stat-print-std.c | 13 +
> tools/perf/util/stat-print.c | 500 ++++++++++++++++++++++++++++++
> tools/perf/util/stat-print.h | 137 ++++++++
> tools/perf/util/stat.h | 6 +
> 9 files changed, 744 insertions(+), 50 deletions(-)
> create mode 100644 tools/perf/util/stat-print-csv.c
> create mode 100644 tools/perf/util/stat-print-json.c
> create mode 100644 tools/perf/util/stat-print-std.c
> create mode 100644 tools/perf/util/stat-print.c
> create mode 100644 tools/perf/util/stat-print.h
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 3f685beba384..532856f8be90 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -40,62 +40,64 @@
> * Jaswinder Singh Rajput <jaswinder@kernel.org>
> */
>
> +#include <errno.h>
> +#include <inttypes.h>
> +#include <locale.h>
> +#include <math.h>
> +#include <signal.h>
> +#include <stdlib.h>
> +
> +#include <linux/ctype.h>
> +#include <linux/err.h>
> +#include <linux/list_sort.h>
> +#include <linux/time64.h>
> +#include <linux/zalloc.h>
> +#include <sys/prctl.h>
> +#include <sys/resource.h>
> +#include <sys/stat.h>
> +#include <sys/time.h>
> +#include <sys/types.h>
> +#include <sys/wait.h>
> +#include <unistd.h>
> +
> +#include <api/fs/fs.h>
> +#include <internal/threadmap.h>
> +#include <perf/evlist.h>
> +#include <subcmd/parse-options.h>
> +
> +#include "asm/bug.h"
> #include "builtin.h"
> +#include "util/affinity.h"
> +#include "util/bpf_counter.h"
> #include "util/cgroup.h"
> -#include <subcmd/parse-options.h>
> -#include "util/parse-events.h"
> -#include "util/pmus.h"
> -#include "util/pmu.h"
> -#include "util/tool_pmu.h"
> +#include "util/color.h"
> +#include "util/counts.h"
> +#include "util/cpumap.h"
> +#include "util/debug.h"
> #include "util/event.h"
> #include "util/evlist.h"
> #include "util/evsel.h"
> -#include "util/debug.h"
> -#include "util/color.h"
> -#include "util/stat.h"
> #include "util/header.h"
> -#include "util/cpumap.h"
> -#include "util/thread_map.h"
> -#include "util/counts.h"
> -#include "util/topdown.h"
> +#include "util/intel-tpebs.h"
> +#include "util/iostat.h"
> +#include "util/metricgroup.h"
> +#include "util/parse-events.h"
> +#include "util/pfm.h"
> +#include "util/pmu.h"
> +#include "util/pmus.h"
> #include "util/session.h"
> -#include "util/tool.h"
> +#include "util/stat-print.h"
> +#include "util/stat.h"
> #include "util/string2.h"
> -#include "util/metricgroup.h"
> #include "util/synthetic-events.h"
> #include "util/target.h"
> +#include "util/thread_map.h"
> #include "util/time-utils.h"
> +#include "util/tool.h"
> +#include "util/tool_pmu.h"
> #include "util/top.h"
> -#include "util/affinity.h"
> -#include "util/pfm.h"
> -#include "util/bpf_counter.h"
> -#include "util/iostat.h"
> +#include "util/topdown.h"
> #include "util/util.h"
> -#include "util/intel-tpebs.h"
> -#include "asm/bug.h"
> -
> -#include <linux/list_sort.h>
> -#include <linux/time64.h>
> -#include <linux/zalloc.h>
> -#include <api/fs/fs.h>
> -#include <errno.h>
> -#include <signal.h>
> -#include <stdlib.h>
> -#include <sys/prctl.h>
> -#include <inttypes.h>
> -#include <locale.h>
> -#include <math.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <sys/wait.h>
> -#include <unistd.h>
> -#include <sys/time.h>
> -#include <sys/resource.h>
> -#include <linux/err.h>
> -
> -#include <linux/ctype.h>
> -#include <perf/evlist.h>
> -#include <internal/threadmap.h>
>
> #ifdef HAVE_BPF_SKEL
> #include "util/bpf_skel/bperf_cgroup.h"
> @@ -123,6 +125,7 @@ static struct target target;
> static volatile sig_atomic_t child_pid = -1;
> static int detailed_run = 0;
> static bool transaction_run;
> +static bool use_perf_stat_print;
Please align.
Thanks,
Namhyung
next prev parent reply other threads:[~2026-07-16 22:22 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 22:33 [RFC PATCH v1 00/14] perf stat: Decouple and modularize metrics/events output printing API Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-05-22 23:47 ` sashiko-bot
2026-05-22 22:33 ` [RFC PATCH v1 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-05-22 22:54 ` sashiko-bot
2026-05-22 22:33 ` [RFC PATCH v1 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-05-22 23:01 ` sashiko-bot
2026-05-22 22:33 ` [RFC PATCH v1 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-05-22 22:59 ` sashiko-bot
2026-05-22 22:33 ` [RFC PATCH v1 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-22 22:48 ` sashiko-bot
2026-05-22 22:33 ` [RFC PATCH v1 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-05-22 23:02 ` sashiko-bot
2026-05-22 22:33 ` [RFC PATCH v1 11/14] perf stat: Extend JSON output linter to test core aggregation checks Ian Rogers
2026-05-22 22:53 ` sashiko-bot
2026-05-22 22:33 ` [RFC PATCH v1 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 00/14] perf stat: Decouple and modularize metrics/events output printing API Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-05-25 23:38 ` Arnaldo Carvalho de Melo
2026-05-25 23:48 ` Ian Rogers
2026-05-26 0:20 ` Arnaldo Carvalho de Melo
2026-05-25 23:18 ` [RFC PATCH v2 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-05-25 23:49 ` Arnaldo Carvalho de Melo
2026-05-26 0:09 ` Ian Rogers
2026-05-25 23:53 ` sashiko-bot
2026-05-25 23:18 ` [RFC PATCH v2 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-05-25 23:39 ` Arnaldo Carvalho de Melo
2026-05-25 23:18 ` [RFC PATCH v2 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 11/14] perf stat: Extend JSON output linter to test core aggregation checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-05-25 23:19 ` [RFC PATCH v2 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-05-25 23:53 ` sashiko-bot
2026-06-05 18:02 ` [RFC PATCH v2 00/14] perf stat: Decouple and modularize metrics/events output printing API Chun-Tse Shao
2026-07-16 4:32 ` [PATCH v3 00/14] perf stat: Decouple printing API and introduce streaming zero-allocation printers Ian Rogers
2026-07-16 4:32 ` [PATCH v3 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-07-16 4:47 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-07-16 4:44 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-07-16 4:42 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-07-16 4:38 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-07-16 4:43 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-07-16 4:43 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-07-16 4:46 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 11/14] perf stat: Extend JSON output linter to test core aggregation checks Ian Rogers
2026-07-16 4:42 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-07-16 4:52 ` sashiko-bot
2026-07-16 4:32 ` [PATCH v3 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-07-16 4:49 ` sashiko-bot
2026-07-16 7:02 ` [PATCH v4 00/14] perf stat: Decouple and modularize display formatting Ian Rogers
2026-07-16 7:02 ` [PATCH v4 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-07-16 7:16 ` sashiko-bot
2026-07-16 22:22 ` Namhyung Kim [this message]
2026-07-16 7:02 ` [PATCH v4 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-07-16 7:24 ` sashiko-bot
2026-07-16 22:30 ` Namhyung Kim
2026-07-16 7:02 ` [PATCH v4 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-07-16 22:32 ` Namhyung Kim
2026-07-16 7:02 ` [PATCH v4 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-07-16 7:11 ` sashiko-bot
2026-07-16 22:35 ` Namhyung Kim
2026-07-16 7:02 ` [PATCH v4 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-07-16 7:19 ` sashiko-bot
2026-07-16 22:43 ` Namhyung Kim
2026-07-16 7:03 ` [PATCH v4 11/14] perf stat: Extend JSON output linter to test core aggregation checks Ian Rogers
2026-07-16 7:03 ` [PATCH v4 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 7:03 ` [PATCH v4 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-07-16 7:03 ` [PATCH v4 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-07-16 7:16 ` sashiko-bot
2026-07-16 22:48 ` [PATCH v4 00/14] perf stat: Decouple and modularize display formatting Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=allZnbHwHtZhfn9Y@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ctshao@google.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox