Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been running the following command on my linux box:

watch -d -n 1 "cat /proc/19866/stat"

The pid above is a pid of Nginx's master process - I would expect the following fields to be changing: 14, 15, 16 and 17 as according to kernel docs those should contain amount of time the process has been scheduled in user/kernel mode (14,15) and its children too (16,17), however running this command in watch I noticed that none of those numbers ever change. Can someone shed a bit more light on this ? I'd like to count some CPU usage stats per process and I thought /proc.. was the place to look. Thanks!

share|improve this question
add comment

1 Answer

Try constructing a simple shell script using the ps command. Based on the implementation, you can get the command to output only those fields that are interesting to you.

share|improve this answer
1  
but isn't ps reading from /proc too ? At least that's what I thought it was doing... –  gyre Jan 6 '13 at 1:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.