Get process running CPU core and the utilisation on that core...
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Get process running CPU core and the utilisation on that core...
Dear Sir,Madom,
Assume someone bind a particular process to a particular CPU core(In multi core machine) by using sched_setaffinity() like functions. Then how we can get that process running core id and CPU core utilisation of that process on that running CPU core(Pragmatically or by a Linux command)?. Any ideas please. Thank you.
Distribution: Linux Mint 9, Linux Mint 17.2(xfce), LMDE2(Mate), Debian Jessie minimal (with standalone OBox)
Posts: 299
Rep:
Top cpu processes, system information
Install conky, if possible on your system, from synaptic. You can then change the ~/.conkyrc to suit you. Mine gives something like the text on the right in the Screenshot.
To get list of all running processes and their IDs run "ps -x" in the terminal.
Last edited by mzsade; 04-28-2010 at 01:28 AM.
Reason: forgot tags
Have a look in /proc/<pid>/stat
That will give you the number of jiffies used over a period - you'll have to calculate the percentage(s) yourself. If the process is bound to a particular processor, the "last used CPU" will always be the same.
Another option is to use cgroups and use the accounting that provides - documentation in the (kernel) source tree.
PS: Can u give me the field names of these values(Any reference)?
(I referred http://lkml.org/lkml/2007/5/31/437. If u know a good reference please be kind enough to inform it to me.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.