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.

The Time+ column in my top command is not reporting the correct time for a running php script. It fluctuates up and down first reporting something like

TIME+
22:39.35 php

And then three seconds later reporting

TIME+
7:12.41 php

And then another three seconds later reporting

TIME+
42:44.21 php

Any clues as to why this is occurring?

Edit:

I hit "c" to toggle the name of the process so I know it's the same process. The time is still being reported incorrectly.

share|improve this question
1  
You're 100% sure you were looking at the same process ID each time? –  David Schwartz Nov 23 '11 at 21:34
    
Yes, it seems like it's something out of the twilight zone. However this time fluctuation only occurs with this particular script, all the others are correctly reported. –  user784637 Nov 23 '11 at 21:38
add comment

3 Answers

up vote 1 down vote accepted

Are you certain these are the same php processes? I bet you have multiple php processes that are "jumping on top".

If you want to better and easily monitor all php processes, I recommend using 'htop' much easier for what you are looking at.

share|improve this answer
    
Yah I hit "C" to toggle the name of the process... –  user784637 Nov 23 '11 at 22:29
add comment

By default top sorts by %CPU, so you're going to see the process in the list move around. Use the < key repeatedly to move the sort column over to PID and the list will stop "jumping around" (at least, as long as new processes aren't stopping or starting). Alternatively, do a ps p PID u (substituting in the PID of the php process of interest) to see just that process in a ps listing. If the time isn't "jumping around" there then you're likely seeing an artifact of sorting in top.

share|improve this answer
add comment

That value is calculated by taking the 14th field from /proc//stat which the kernel manages.

The value in question -- as far as I understand it -- only ever increases in 'jiffies' (effectively 100ths of a second).

Can you cat the value of /proc//stat for that pid ten seconds after one another?

share|improve this answer
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.