hi Valdis: Thanks for your kind reply :) 2013/8/15 <Valdis.Kletnieks@vt.edu>:
On Thu, 15 Aug 2013 20:24:21 +0800, loody said:
is there any shell command or tool can let me know which cpu current process run on?
Why are you trying to check from the shell? What problem are you trying to solve by knowing which CPU? I adopt one sample code which uses sched_setaffinity to force user program running on core#1, suppose my environment has core#0 and core#1.
Theoretically, it is ONLY run on core#1. When I use top, I cannot tell whether it runs on core#0 or core#1, so I wrote this letter to ask help any tool checking what cpu this program ran on. i also attach my program for all your reference.
And checking the *current* process tells you even less than "checking the process you care about" - because unless it's a shell builtin, when you launch the command, it will quite possibly end up on some core other than the one the shell is running on....
it seems I use wrong way to express what I need. I need any tool to check whether the process I assigned to cpu with sched_setaffinity did work. -- Regards,