From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 4BA3939021D for ; Thu, 16 Jul 2026 07:03:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784185419; cv=none; b=qt0+zkY7Il8YGBrczueWI6CGCRhaFrrRqo3F5yAU1+RdzY4BqmI+xxA6IL1DsViua5FW2NUTA+QjSzT1qs0HnsrXUq4qAxy54zXE0bZQzisooqosMlmEq53QIWmJcP7GVz2Su/gScevg45YRU7jvEW15+9H4xXLlTGpEbvjk2Js= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784185419; c=relaxed/simple; bh=eNpfZh1dpIFAekfalGaQk+/eINW92GCphOzZiYJOV5s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=bBcejmFILwpg2J95tmnK7PC9gp7z1qrrgZda9kxzC2vNifsLsyWZ1OmFGeEtPg/DmlNvv8IucrraHmKMELnvl+Xj7hf3JGqg4WhyEW3Hs2yCKOp5W9/k3ZmIszt4CsO3cs1a9zpD5qXw9rsJfJQrMJ4gzuQSsz79+kNyFpYatTQ= 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=QfbUcIRJ; arc=none smtp.client-ip=209.85.216.74 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="QfbUcIRJ" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-3811279d51aso5336745a91.1 for ; Thu, 16 Jul 2026 00:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784185418; x=1784790218; 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=iU1fZww4Tcrag6lxNEeuKCJy8Y+7g+3ojiLQofYJ2MA=; b=QfbUcIRJvzKx3jExKpsWyL52G0SD9EV5x0j1sB4cVi5tuUqpw635AdGgT+jh7i3QdV xSfjA8ckUUP+rlR4AuEJCx7OKHRol3BhPgR8PL0Ck1EJADcmEtWLBTxGGTKFNLNCcOpl xE5DMAXBJI1W4orvh/MamGa2f7JCEbNm8MJ9riteLoZs7P1io2UdTFCUWTPgF6OvETBD Xe4HyOcbYgbeK38xMZ91cukICz853rNie8vdxaHSOsM7CnbhaAwKHJ/+HNxDi/mfLwFM IvuhinxNL6Lp6zChB7V3ljaqRKIGHPsaO+HA+YMuPhX+cC0v+E6UqPlgb/NntVhU27o7 8wHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784185418; x=1784790218; 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=iU1fZww4Tcrag6lxNEeuKCJy8Y+7g+3ojiLQofYJ2MA=; b=JqjMcgKriUOJhUbLx6RBZIFbj251Jh19LxZ6/iZrszaIWnLVesbcVDAcS1OmjTbHQl V34ZAUujVPK6YY6TQnJu61DV3bP4x9/6/LJpNYKO8+XtHpKAl3k6++WBGvHt98tQH76w ApTXEet2DFfv8CZbxM5XfxTF/T0CUVcCCbMBogul7AxXzhhNU4MFCFHMpOuVKbA1dzDv 4c2HwXak7CmHUnuRwk7llHiK4xRu3Ajix8NHa2Co20lf9iGoH+TF6LSXPtzjzKlItnW8 WQCnNCXVEkEq6oHMFR7qw8HH/vi0nQgwEovTqrGhWea6UO9dM7m2Qezz3byle/0X2wlH IUzA== X-Forwarded-Encrypted: i=1; AHgh+RqwhWLUfSvgHekqKBIMpTh9xYK72AzjAiQhVyzBctdkgOSLmntlT8xsvvNympM/fYWHKcSWkDuqEKDPDKM=@vger.kernel.org X-Gm-Message-State: AOJu0YyVh8z1MkvRBDq+rQ0rtQVpkOfeSzpVQRYqXr8klBEHYz44YmRT zoyCb5UFk1iS1rori5YT3OWw1eFKTvlUff45+jWTQ2cTlLhVvbH3/5HmITE+3gWwBa+BihB2/eZ lLCQarhB+4w== X-Received: from dyee27.prod.google.com ([2002:a05:693c:629b:b0:30c:83f3:7370]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:38c8:b0:38d:dbc7:5178 with SMTP id 98e67ed59e1d1-38ddbc75254mr17482013a91.22.1784185417275; Thu, 16 Jul 2026 00:03:37 -0700 (PDT) Date: Thu, 16 Jul 2026 00:03:02 -0700 In-Reply-To: <20260716070303.507066-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: <20260716043223.388233-1-irogers@google.com> <20260716070303.507066-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.141.g00534a21ce-goog Message-ID: <20260716070303.507066-14-irogers@google.com> Subject: [PATCH v4 13/14] perf stat: Add --new support to PMU metrics Python validator From: Ian Rogers To: irogers@google.com, acme@kernel.org, ctshao@google.com, namhyung@kernel.org 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 patch extends the performance metrics value Python validation script tools/perf/tests/shell/lib/perf_metric_validation.py to support a new command-line argument `-new`: parser.add_argument("-new", help="Use new printing API (--new)", ...) When set, the Validator class appends the `--new` option flag to its internally spawned `perf stat` commands: command = [tool, 'stat'] if self.new_print: command.append('--new') This enables validating Intel PMU metric mathematical values generated specifically by the decoupled, streaming JSON printing callbacks. Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.5-flash Acked-by: Chun-Tse Shao --- tools/perf/tests/shell/lib/perf_metric_validation.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/shell/lib/perf_metric_validation.py b/tools/perf/tests/shell/lib/perf_metric_validation.py index 3d52f94f22b9..b8397234eebc 100644 --- a/tools/perf/tests/shell/lib/perf_metric_validation.py +++ b/tools/perf/tests/shell/lib/perf_metric_validation.py @@ -36,7 +36,7 @@ class TestError: class Validator: def __init__(self, rulefname, reportfname='', t=5, debug=False, datafname='', fullrulefname='', - workload='true', metrics='', cputype='cpu'): + workload='true', metrics='', cputype='cpu', new_print=False): self.rulefname = rulefname self.reportfname = reportfname self.rules = None @@ -68,6 +68,7 @@ class Validator: self.datafname = datafname self.debug = debug self.fullrulefname = fullrulefname + self.new_print = new_print def __set_metrics(self, metrics=''): if metrics != '': @@ -379,7 +380,10 @@ class Validator: def _run_perf(self, metric, workload: str): tool = 'perf' - command = [tool, 'stat', '--cputype', self.cputype, '-j', '-M', f"{metric}", "-a"] + command = [tool, 'stat'] + if self.new_print: + command.append('--new') + command.extend(['--cputype', self.cputype, '-j', '-M', f"{metric}", "-a"]) wl = workload.split() command.extend(wl) print(" ".join(command)) @@ -587,6 +591,8 @@ def main() -> None: parser.add_argument("-m", help="Metric list to validate", default="") parser.add_argument("-cputype", help="Only test metrics for the given CPU/PMU type", default="cpu") + parser.add_argument("-new", help="Use new printing API (--new)", + action="store_true", default=False) args = parser.parse_args() outpath = Path(args.output_dir) reportf = Path.joinpath(outpath, 'perf_report.json') @@ -595,7 +601,7 @@ def main() -> None: validator = Validator(args.rule, reportf, debug=args.debug, datafname=datafile, fullrulefname=fullrule, workload=args.wl, - metrics=args.m, cputype=args.cputype) + metrics=args.m, cputype=args.cputype, new_print=args.new) ret = validator.test() return ret -- 2.55.0.141.g00534a21ce-goog