How to get information about process in Linux
How can I get process statistics from the kernel and return the buf as the following?
number of processes : ticks_user : ticks_system : ticks_interrupt :开发者_JAVA技巧 cpuseconds : procsizes : resident segment sizes
I found some information in /proc/[pid]/stat
, but there is no data about ticks system, ticks_interrupt, and cpusecond.
Where can I find information about these?
Any pointers to API or documentation will be helpful.
Use
ps ax
top
htop
for the start, read the manpage, and for top/htop press h to get a help screen q to quit;
However, none of the manpages mentions ticks - what is it?
You may can give vmstat a try. It is not in ticks, but why do you need ticks?
CPU
These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)
id: Time spent idle. Prior to Linux 2.5.41, this includes I/O-wait time.
wa: Time spent waiting for I/O. Prior to Linux 2.5.41, included in idle.
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
What are you planing to do with this information?
Sometimes it may also to grep through the kernel sources, trying your buzzwords.
精彩评论