How to find what task is running on a particular cpu core ?
I am using Kernel 18.104.22.168 on an Intel Core2Duo based system.
1) I have to find on which core a particular task is running on .
2) I have to just log whenever my task is scheduled on any of the cores with the cpu core number & timestamp info.
I am ready to modify the kernel to do printk or some logging .
I guess there used to be 2 fields called 'processor' and 'last_processor' in task_struct in older kernels which probably had this information .
So what do I do to find out on which core a particular task is running on ?
Are there any utilities that are simple-to-use and can display the tasks that are running on each of the cores , including the cpu core info ? top , mpstat etc do not tell you on which cpu core a task is running on .
top will, not by default, but if you add the field according to the man page on my system.
Simplest is to use /proc/<pid>/stat (which is where top is getting it from in all likelihood).
But as per above, this is "last processor" dispatched on. Given the way the scheduler attempts to keep tasks on the same processor, this should normally suffice.
|All times are GMT -5. The time now is 11:22 AM.|