summaryrefslogtreecommitdiff
path: root/sys/kern/kern_accnt.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-16 20:48:35 -0400
committerIan Moffett <ian@osmora.org>2025-07-16 20:48:35 -0400
commit8a3973e46941b6a8c88a49594364a04ee4b1d84e (patch)
tree68ffb351283d9ac5694c5f37808d3ee1ed9fdc73 /sys/kern/kern_accnt.c
parentf6900b5c3b4832f48359fd761b80f8693a6735e8 (diff)
kernel: accnt: Keep track of per-cpu stats
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_accnt.c')
-rw-r--r--sys/kern/kern_accnt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/kern/kern_accnt.c b/sys/kern/kern_accnt.c
index 3b90d9f..cd15863 100644
--- a/sys/kern/kern_accnt.c
+++ b/sys/kern/kern_accnt.c
@@ -66,9 +66,23 @@ ctl_stat_read(struct ctlfs_dev *cdp, struct sio_txn *sio)
void
sched_stat(struct sched_stat *statp)
{
+ struct sched_cpu *cpustat;
+
statp->nproc = atomic_load_64(&g_nthreads);
statp->ncpu = cpu_count();
statp->quantum_usec = DEFAULT_TIMESLICE_USEC;
+
+ /*
+ * Setup the per-cpu info/statistics
+ */
+ for (int i = 0; i < CPU_MAX; ++i) {
+ cpustat = cpu_get_stat(i);
+ if (cpustat == NULL) {
+ break;
+ }
+
+ statp->cpus[i] = *cpustat;
+ }
}
void