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?
hope it can help
Percent of cpu usage per thread you can get with
ps
command:The way it is calculated is described in
ps manpage
: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.
Maybe have a look at htop, you can configure quite a lot with it.
Did you tried sar? It can fetch a lot of information even on pid level.
Nagios and PNP http://docs.pnp4nagios.org/pnp-0.4/start
Works awesome... little configuration.
I have stumbled on this on a embedded system where we don't have the fancy tools to look in to this stuff.
For this, I have used
cpuacct cgroup
and placed each thread into its own folder. This way I was able to measure their usage.Hierarchy was looking like this:
Then I changed it to