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

I am observing (based on logs) that my (java) process pauses for something during execution. My first guess is a context switch. In order to verify I am trying to find (a) the number of involuntary context-switches that my process incurs, and (b) the amount of time the process spends in the run queue (ready to run but waiting to be scheduled).

Are there any tools to gather this information. I am running kernel 2.6.18 (centos 5) and 2.6.32 (centos6).

share|improve this question
    
Systemtap would do it. Have you used it before? I can try to write a sample stap code for you. –  Soham Chakraborty Jan 8 '13 at 3:25
    
Thanks. Looks fairly powerful. A sample code would help get started. –  Sumit Jan 9 '13 at 7:05

1 Answer 1

To view the context switch behavior in the OS, use:

vmstat 2 200

When the app server starts and you see the context switching climb, then your theory is correct. To see the details around those context switches in detail, you may wish to use VisualVM. This will give you a much more detailed view around the threads, hand-off time, what it is waiting for and much more.

share|improve this answer

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.