summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwapnil Sapkal <swapnil.sapkal@amd.com>2026-01-27 18:49:59 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-01-28 15:18:39 -0300
commitf7dc49645346d9d47825b60c4557da6885d48037 (patch)
treefad145335926cb805252e2568d1f1a4b083e97f4
parent7284dc7e19fab1ff425579cbb4721fff292ac70e (diff)
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 <sshegde@linux.ibm.com> Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Anubhav Shelat <ashelat@redhat.com> Cc: Chen Yu <yu.c.chen@intel.com> Cc: Gautham Shenoy <gautham.shenoy@amd.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-sched.c21
1 files 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: <ALL CPUS SUMMARY>\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);