From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74AD832B127 for ; Thu, 16 Jul 2026 04:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784176379; cv=none; b=I5d8gHD8PpPwyNad4nMCdg1TUm7DVDZ67/dFkPccjJz+vGyblnG1ZoL7z+NFPuLu+hdElIxCcsd6pLCh+SNIdrmuJxtrrsePP9JprDknfUFBX06rhd7+GfA6Y8H8MrBQJwr8lLb8xi4E3HEqATvvLJ4dBcq01QOSJWkf6yMZ+GE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784176379; c=relaxed/simple; bh=b35rXffZYFEDkTobyqbBJXoM4GZDXWeK0joExTqvg+g=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WXAqIZmfoW92Mca9XuH9ExRGOPDgKLVlKO4NvEkDAQjiOePHB0Ipen7hZxDPRgSrt1COp6bEyaU3mEQdWfrqKO7ENaayb4F8eH+sWJuMaSg/HNizO84EaFLSWh1245slLpTFpVf9HGtIDqqxKkD6sdur7ZvQOmTPnI/8mdQzNeg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pPnBocWm; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pPnBocWm" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-cb11535e6a1so2690679a12.0 for ; Wed, 15 Jul 2026 21:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784176377; x=1784781177; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=DhzoqwN5HbrEvT9zJU8a2Bw0ptYhAl2ZYOUB0LRqaUU=; b=pPnBocWmNcvOK0yHCdWaXutFMwpuCFnNi04Ho8jYDEfKqVsuCvh3O68Mv+jzuHBnGx tVTPeVKvvD4B6Rfi8dee40fMlu+lip5g76e3xMwnhwZKWEKngEQyl3QWCmGGaTd5jHGL Je7Vt8xcIsc3sqQrSFjKQ6N0pNTrv2PJCw2ysqFSaLb+676Yl1uS2ZQSMewjqhGUN/qJ PqGucJ4BUxJJshDvScZ8uxmHDx+Lz6qRyZUj2n/71x5fc8c0Oe5V9SsX+wJ1kyBwZJf/ 3HedIXLzgeWET8FUjLaJMwAHDG/Lg15heiWW5eWn2t6hGQqQTBddk5momPoC+fyMyNOk iAiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784176377; x=1784781177; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DhzoqwN5HbrEvT9zJU8a2Bw0ptYhAl2ZYOUB0LRqaUU=; b=KUhPyFwYfYcXD42goHrTLDcUQb2M0NXnAXFe8a7RSo19mzXEpUDUoe3s6ou15Z8U4U LSGIhKmAdLEOUCakwxeQ+ygq2m14fUT+fqVo6dwC4giFnj85YYDTqHuEeC7+hekyOKg1 pmJSW8tfGj9H2eWXH+uFpQbEc3g8ucr4X716ApctM7ZFBZIzMAi7FoW1dJrzlL66RfRD u7LSHh5wcj9sUoSd2HLHblRrP9fJvPURsPp7R9ZsYuPfQU1tXz4is+j3mbXnmaCRJY7e K+d+7+/+w9Jg4QTlfJQrqTZ8KognWO48/pI7wgC9EsEps/lqeSvxuiExWl1YwMuAd5mT pacg== X-Forwarded-Encrypted: i=1; AHgh+Ro1FRuVceyUqm6MMcFPnSrWnK9xZ65mdErR7w7TLymCz4k2ncviOKCU6Yhk9VTh/Rtd2kPZ/hZT7VnRTcU=@vger.kernel.org X-Gm-Message-State: AOJu0YxknFVYjo7SHJk9/j80VcXa3jXZrfcVDUTZusbaL3Yq+4iLrk9V DjUeGgTW5ApMamnMJM3d1RUDhZTRcYd+2QTi/wFEDQpjSrXfqETT7vGH23MYDrS5CEvp+bdPVIA YdEBvgTzKpw== X-Received: from dlad14.prod.google.com ([2002:a05:701b:220e:b0:139:c8ec:c97d]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:72a3:b0:3bf:8de9:c647 with SMTP id adf61e73a8af0-3c36bd75a44mr5853273637.0.1784176376642; Wed, 15 Jul 2026 21:32:56 -0700 (PDT) Date: Wed, 15 Jul 2026 21:32:09 -0700 In-Reply-To: <20260525231900.3527228-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260525231900.3527228-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.141.g00534a21ce-goog Message-ID: <20260716043223.388233-1-irogers@google.com> Subject: [PATCH v3 00/14] perf stat: Decouple printing API and introduce streaming zero-allocation printers From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org, ctshao@google.com Cc: 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 Content-Type: text/plain; charset="UTF-8" This is V3 of the patch series implementing the decoupled perf stat printing architecture. This series fully separates the format-specific display engines (STD, CSV, JSON) into distinct isolated files, and guarantees 100% streaming, zero-allocation output for interval metric-only JSON data to avoid debug artifact overwrites and large allocations on extended system-wide runs. Changes since v2: - Fixed trailing newline count and padding logic for wide metric names in standard console (STD) metric-only interval modes, resolving reports from Sashiko AI. - Resolved aggr header label misalignments for Socket/Die/Node/Cache modes. - Addressed debug artifact overwrite bugs in the `stat_metrics_values.sh` rules validation engine by correctly scoping execution passes and preserving artifacts upon failure. - Reverted all reflow diff noise in `builtin-stat.c` and legacy metric print functions in `util/stat-display.c` per feedback from Arnaldo. - Converted all format callback file creations to use standard `//` SPDX header formatting directly in the patch series to prevent downstream diff noise. - Resolved all internal brace styles, variable declaration spacing, and unwrapped commit description warnings reported by checkpatch.pl. - Added all requested Acked-by tags from reviewers. Ian Rogers (14): perf stat: Introduce core generic print traversal engine and header stubs perf stat: Implement standard console (STD) formatting callbacks perf stat: Extend STD output linter to test basic New API checks perf stat: Extend STD output linter to test core aggregation checks perf stat: Extend STD output linter to test advanced PMU checks perf stat: Extend STD output linter to test metric-only checks perf stat: Implement CSV formatting callbacks perf stat: Extend CSV output linter to test core aggregation checks perf stat: Extend CSV output linter to test advanced PMU and metric-only checks perf stat: Implement streaming JSON formatting callbacks perf stat: Extend JSON output linter to test core aggregation checks perf stat: Extend JSON output linter to test advanced PMU and metric-only checks perf stat: Add --new support to PMU metrics Python validator perf stat: Extend PMU metrics value linter to validate --new outputs tools/perf/builtin-stat.c | 96 +- .../tests/shell/lib/perf_metric_validation.py | 12 +- tools/perf/tests/shell/stat+csv_output.sh | 19 + tools/perf/tests/shell/stat+json_output.sh | 74 +- tools/perf/tests/shell/stat+std_output.sh | 18 + tools/perf/tests/shell/stat_metrics_values.sh | 22 +- tools/perf/util/Build | 4 + tools/perf/util/stat-display.c | 6 +- tools/perf/util/stat-print-csv.c | 534 +++++++++++ tools/perf/util/stat-print-json.c | 330 +++++++ tools/perf/util/stat-print-std.c | 828 ++++++++++++++++++ tools/perf/util/stat-print.c | 489 +++++++++++ tools/perf/util/stat-print.h | 133 +++ tools/perf/util/stat.h | 2 + 14 files changed, 2488 insertions(+), 79 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 -- 2.55.0.141.g00534a21ce-goog