From 55657d7ac8caa98c7c0ef241bf64e176db899b4d Mon Sep 17 00:00:00 2001 From: Swapnil Sapkal Date: Mon, 19 Jan 2026 17:58:26 +0000 Subject: perf sched stats: Add schedstat v16 support The /proc/schedstat file output is standardized with version number. Add support to record and raw dump v16 version layout. Version 16 of schedstats changed the order of definitions within 'enum cpu_idle_type', which changed the order of [CPU_MAX_IDLE_TYPES] columns in show_schedstat(). In particular the position of CPU_IDLE and __CPU_NOT_IDLE changed places. Co-developed-by: Ravi Bangoria Signed-off-by: Ravi Bangoria Signed-off-by: Swapnil Sapkal Tested-by: Chen Yu Tested-by: James Clark Acked-by: Ian Rogers Acked-by: Peter Zijlstra Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Anubhav Shelat Cc: Ben Gainey Cc: Blake Jones Cc: Chun-Tse Shao Cc: David Vernet Cc: Dmitriy Vyukov Cc: Dr. David Alan Gilbert Cc: Gautham Shenoy Cc: Graham Woodward Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Juri Lelli Cc: K Prateek Nayak Cc: Kan Liang Cc: Leo Yan Cc: Madadi Vineeth Reddy Cc: Mark Rutland Cc: Namhyung Kim Cc: Sandipan Das Cc: Santosh Shukla Cc: Shrikanth Hegde Cc: Steven Rostedt (VMware) Cc: Tejun Heo Cc: Thomas Falcon Cc: Tim Chen Cc: Vincent Guittot Cc: Yang Jihong Cc: Yujie Liu Cc: Zhongqiu Han Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/event.c | 6 ++++++ tools/perf/util/synthetic-events.c | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'tools/perf') diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 5a98c16e1092..730021cec161 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -585,6 +585,9 @@ size_t perf_event__fprintf_schedstat_cpu(union perf_event *event, FILE *fp) if (version == 15) { #include return size; + } else if (version == 16) { +#include + return size; } #undef CPU_FIELD @@ -604,6 +607,9 @@ size_t perf_event__fprintf_schedstat_domain(union perf_event *event, FILE *fp) if (version == 15) { #include return size; + } else if (version == 16) { +#include + return size; } #undef DOMAIN_FIELD diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c index 5366ea921e70..4ce37357db05 100644 --- a/tools/perf/util/synthetic-events.c +++ b/tools/perf/util/synthetic-events.c @@ -2567,6 +2567,8 @@ static union perf_event *__synthesize_schedstat_cpu(struct io *io, __u16 version if (version == 15) { #include + } else if (version == 16) { +#include } #undef CPU_FIELD @@ -2620,6 +2622,8 @@ static union perf_event *__synthesize_schedstat_domain(struct io *io, __u16 vers if (version == 15) { #include + } else if (version == 16) { +#include } #undef DOMAIN_FIELD @@ -2661,6 +2665,8 @@ int perf_event__synthesize_schedstat(const struct perf_tool *tool, if (!strcmp(line, "version 15\n")) { version = 15; + } else if (!strcmp(line, "version 16\n")) { + version = 16; } else { pr_err("Unsupported %s version: %s", path, line + 8); goto out_free_line; -- cgit v1.2.3