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'm interested in the current usage of cpu - precisely cpu% and wait% - for each thread in a specific application. Is it possible to get that information from somewhere?

I know that top can split information per real thread (ones with pid), but it doesn't show the system/user/wait cpu usage split for each of them. I would also like some way to log that info. Do you know any apps (or apis) that can do that?

share|improve this question

5 Answers 5

up vote 3 down vote accepted

I'd look into SystemTap. This tool will certainly give you what you want. There is this example of profiling threads; don't know if it has all you want, but you could modify it so that it does.

share|improve this answer

Nagios and PNP http://docs.pnp4nagios.org/pnp-0.4/start

Works awesome... little configuration.

share|improve this answer

Did you tried sar? It can fetch a lot of information even on pid level.

share|improve this answer

Percent of cpu usage per thread you can get with ps command:

 ps -emo %cpu,pid,user,args

The way it is calculated is described in ps manpage:

Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage.

share|improve this answer
    
I'm really interested in both cpu time and io-wait time. ps can't handle the second one unfortunately. –  viraptor Jul 9 '09 at 12:41

Maybe have a look at htop, you can configure quite a lot with it.

share|improve this answer
    
unfortunately it cannot split the cpu on user/system/wait time for a specific thread - only for the whole machine –  viraptor Jul 9 '09 at 12:37

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.