If my PC has four CPUs(CPU0, CPU1, CPU2, CPU3), how can I know the number of running processes and the queue length of each CPU?
2 Answers
In /proc/sched_debug you can see for each cpu:
- the number of running processes (cfs_rq[0].nr_running)
the runnable processes (runnable tasks)
cat /proc/sched_debug | less
Look at the /proc/stat and /proc/schedstat files. There is also information per process in /proc/<pid>/stat.
- Information on /proc/stat is here: http://lxr.linux.no/#linux+v3.3/fs/proc/stat.c
- Information on /proc/schedstat : http://lxr.linux.no/#linux+v3.3/kernel/sched/stats.c