Need the process currently executing on a given CPU
I know how to obtain the cpu [core] ID that a given process is currently running on (or last ran on) by, for example, looking in /proc/<pid>/stat. But I need it the other way around: I need to know the process that is currently running on a given cpu. Other than the slow, inefficient way -- searching through all the /proc/*/stat for the cpu in question -- is there anything in /proc or /sys or whatever that will give me the answer more directly? What I need is a snapshot of the CPU's status, rather than a snapshot of a process's status.
|