Need to write a code in C to find the top 10 process which are utilizing most of the
Hey I have to make a tool to monitor the top 10 processes utilizing the most of the CPU. Need to write a c code.. can any one help from which system file I can read the cpu utilization. tried getting info from proc/<pid>/stat statm status .
|
Is this a homework assignment?
What happened when you looked at those files in /proc? Do you have the format that describes what they contain? Have you looked at the "top" command? |
you don't need c programming... only a shell command...
Code:
ps aux|sort -k3 |tail |
...and as this is an open source OS, you can increase your understanding of how these things are done by looking at the source code of something that does it...
Hope that helps with the homework! |
Thanks
Thanks for the response but I need to write a c code for getting the top 10 processes that are using the most cpu..
/proc/<PID>/ folder contains folder like stat statm status which contains a lot of information like utime stime .... Can I use these info to calculate the cpu usage? |
All times are GMT -5. The time now is 07:02 PM. |