you can use ps
.
e.g. having python process with two busy threads on dual core CPU:
$ ps -p 29492 -L -o pid,tid,psr,pcpu
PID TID PSR %CPU
29492 29492 1 0.0
29492 29493 1 48.7
29492 29494 1 51.9
(PSR is CPU id the thread is currently assigned to)
you see that the threads are running on the same cpu core (because of GIL)
running the same python script in jython, we see, that the script is utilizing both cores (and there are many other service or whatever threads, which are almost idle):
$ ps -p 28671 -L -o pid,tid,psr,pcpu
PID TID PSR %CPU
28671 28671 1 0.0
28671 28672 0 4.4
28671 28673 0 0.6
28671 28674 0 0.5
28671 28675 0 2.3
28671 28676 0 0.0
28671 28677 1 0.0
28671 28678 1 0.0
28671 28679 0 4.6
28671 28680 0 4.4
28671 28681 1 0.0
28671 28682 1 0.0
28671 28721 1 0.0
28671 28729 0 88.6
28671 28730 1 88.5
you can process the output and calculate the total CPU for each CPU core.
Unfortunately, this approach does not seem to be 100% reliable, sometimes i see that in the first case, the two working threads are reported to be separated to each CPU core, or in the latter case, the two threads are reported to be on the same core..