[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250116151543.80163-8-changwoo@igalia.com>
Date: Fri, 17 Jan 2025 00:15:43 +0900
From: Changwoo Min <changwoo@...lia.com>
To: tj@...nel.org,
void@...ifault.com,
arighi@...dia.com
Cc: kernel-dev@...lia.com,
linux-kernel@...r.kernel.org,
Changwoo Min <changwoo@...lia.com>
Subject: [PATCH 7/7] sched_ext: Print core event count in scx_central scheduler
Modify the scx_central scheduler to print the core event counter
every second.
Signed-off-by: Changwoo Min <changwoo@...lia.com>
---
tools/sched_ext/scx_central.bpf.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tools/sched_ext/scx_central.bpf.c b/tools/sched_ext/scx_central.bpf.c
index 50bc1737c167..1f0dc9861418 100644
--- a/tools/sched_ext/scx_central.bpf.c
+++ b/tools/sched_ext/scx_central.bpf.c
@@ -256,6 +256,8 @@ static int central_timerfn(void *map, int *key, struct bpf_timer *timer)
u64 now = scx_bpf_now();
u64 nr_to_kick = nr_queued;
s32 i, curr_cpu;
+ struct scx_event_stat event;
+ int kind;
curr_cpu = bpf_get_smp_processor_id();
if (timer_pinned && (curr_cpu != central_cpu)) {
@@ -291,6 +293,22 @@ static int central_timerfn(void *map, int *key, struct bpf_timer *timer)
bpf_timer_start(timer, TIMER_INTERVAL_NS, BPF_F_TIMER_CPU_PIN);
__sync_fetch_and_add(&nr_timers, 1);
+
+ /* print event counters every second */
+ if (nr_timers % 1000 == 0) {
+ scx_bpf_event_stat(&event, sizeof(event));
+
+ bpf_printk("%20s: %llu\n", "invalid_select_cpu",
+ scx_read_event(&event, INVAL_SELECT_CPU));
+ bpf_printk("%20s: %llu\n", "offline_local_dsq",
+ scx_read_event(&event, OFFLINE_LOCAL_DSQ));
+ bpf_printk("%20s: %llu\n", "cntd_run_wo_enq",
+ scx_read_event(&event, CNTD_RUN_WO_ENQ));
+ bpf_printk("%20s: %llu\n", "enq_local_exiting",
+ scx_read_event(&event, ENQ_LOCAL_EXITING));
+ bpf_printk("%20s: %llu\n", "rq_bypassing_ops",
+ scx_read_event(&event, RQ_BYPASSING_OPS));
+ }
return 0;
}
--
2.48.1
Powered by blists - more mailing lists