From f7dc49645346d9d47825b60c4557da6885d48037 Mon Sep 17 00:00:00 2001 From: Swapnil Sapkal Date: Tue, 27 Jan 2026 18:49:59 +0000 Subject: [PATCH] perf sched stats: Define macro for SEP_LEN Define a macro for separator length of the line in perf sched stats report. Reviewed-by: Shrikanth Hegde Signed-off-by: Swapnil Sapkal Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Anubhav Shelat Cc: Chen Yu Cc: Gautham Shenoy Cc: Ian Rogers Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Thomas Falcon Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-sched.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 1a24c4869331..3f509cfdd58c 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -55,6 +55,7 @@ #define SYM_LEN 129 #define MAX_PID 1024000 #define MAX_PRIO 140 +#define SEP_LEN 100 static const char *cpu_list; static struct perf_cpu_map *user_requested_cpus; @@ -3997,7 +3998,7 @@ static inline void print_cpu_stats(struct perf_record_schedstat_cpu *cs1, "PCT_CHANGE1", "PCT_CHANGE2"); printf("\n"); - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); #define CALC_PCT(_x, _y) ((_y) ? ((double)(_x) / (_y)) * 100 : 0.0) @@ -4047,8 +4048,8 @@ static inline void print_domain_stats(struct perf_record_schedstat_domain *ds1, #define DOMAIN_CATEGORY(_desc) \ do { \ size_t _len = strlen(_desc); \ - size_t _pre_dash_cnt = (100 - _len) / 2; \ - size_t _post_dash_cnt = 100 - _len - _pre_dash_cnt; \ + size_t _pre_dash_cnt = (SEP_LEN - _len) / 2; \ + size_t _post_dash_cnt = SEP_LEN - _len - _pre_dash_cnt; \ print_separator2((int)_pre_dash_cnt, _desc, (int)_post_dash_cnt);\ } while (0) @@ -4238,14 +4239,14 @@ static int show_schedstat_data(struct list_head *head1, struct cpu_domain_map ** int ret = 0; printf("Description\n"); - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); printf("%-30s-> %s\n", "DESC", "Description of the field"); printf("%-30s-> %s\n", "COUNT", "Value of the field"); printf("%-30s-> %s\n", "PCT_CHANGE", "Percent change with corresponding base value"); printf("%-30s-> %s\n", "AVG_JIFFIES", "Avg time in jiffies between two consecutive occurrence of event"); - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); printf("\n"); printf("%-65s: ", "Time elapsed (in jiffies)"); @@ -4286,16 +4287,16 @@ static int show_schedstat_data(struct list_head *head1, struct cpu_domain_map ** return -1; } - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); if (is_summary) printf("CPU: \n"); else printf("CPU: %d\n", cs1->cpu); - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); print_cpu_stats(cs1, cs2); - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); list_for_each_entry(dptr1, &cptr1->domain_head, domain_list) { struct domain_info *dinfo1 = NULL, *dinfo2 = NULL; @@ -4329,9 +4330,9 @@ static int show_schedstat_data(struct list_head *head1, struct cpu_domain_map ** printf("%s\n", dinfo1->cpulist); } - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); print_domain_stats(ds1, ds2, jiffies1, jiffies2); - print_separator2(100, "", 0); + print_separator2(SEP_LEN, "", 0); if (dptr2) dptr2 = list_next_entry(dptr2, domain_list); -- 2.47.3