linux - Getting the current cpu information -


this question has answer here:

i'm having fun writing simple applications use pthreads. possible thread information core running on? i'm trying play around thread affinity of thread, useful know details of core thread running on.

you can use top command. in particular:

top -h -p pid 

you can see list of threads (for single process) , cpu cores threads running on.

in alternative can take @ /proc/pid/task/tid/stat.

to have reference read informations /proc/ take at: kernel.org

for particular tid if execute:

`cat /proc/pid/task/tid/stat` 

you'll like:

1469 (proc_name) s 1 1463 1463 0 -1 4202560 32 0 0 0 0 0 0 0 25 5 3 0 1287407887 305942528 507 102400000 1 1 0 0 0 0 0 4096 83179 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0

where third field start state of thread (in case sleeping), , sixth field end core last ran on.

in /proc/[pid]/stat section of proc man page each field explained (in case 39th field).


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -