mirror of
https://github.com/sched-ext/scx.git
synced 2024-11-25 20:20:23 +00:00
scx_rustland_core: export counter of online CPUs
Introduce a helper to get the amount of online CPUs tracked by the BPF part. Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
This commit is contained in:
parent
d9c9f78e3e
commit
9a0e7755df
@ -302,6 +302,12 @@ impl<'cb> BpfScheduler<'cb> {
|
||||
}
|
||||
}
|
||||
|
||||
// Counter of the online CPUs.
|
||||
#[allow(dead_code)]
|
||||
pub fn nr_online_cpus_mut(&mut self) -> &mut u64 {
|
||||
&mut self.skel.bss_mut().nr_online_cpus
|
||||
}
|
||||
|
||||
// Counter of currently running tasks.
|
||||
#[allow(dead_code)]
|
||||
pub fn nr_running_mut(&mut self) -> &mut u64 {
|
||||
|
@ -582,9 +582,10 @@ impl<'a> Scheduler<'a> {
|
||||
|
||||
// Print internal scheduler statistics (fetched from the BPF part).
|
||||
fn print_stats(&mut self) {
|
||||
// Show minimum vruntime (this should be constantly incrementing).
|
||||
// Show online CPUs, minimum vruntime and time slice.
|
||||
info!(
|
||||
"min_vruntime={} slice={}us",
|
||||
"cpus={} min_vruntime={} slice={}us",
|
||||
*self.bpf.nr_online_cpus_mut(),
|
||||
self.min_vruntime,
|
||||
self.slice_ns / NSEC_PER_USEC,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user