I have a program running that creates five threads. I want to determine (1) how much CPU time each thread is using, and (2) how much memory each thread is using. I tried the hogs utility, but it does not indicate CPU usage per thread, it only shows that for the ‘main’ program.
Is there some other way I can determine how much CPU time each thread is using? (Two of the threads are running at a higher priority than the other three, so I can’t divide 100% by 5…) Doesn’t look like getrusage() will help either, since the child threads run forever.
I can look at the build map to identify the amount of code-space each thread uses. Is there an easy way I can determine how much data-space each thread uses?
Thanks for your kind help!
I think to find out how much each cpu thread is using you would have to insert special code.
How much data-space does each thread uses? All of it.
Get spin from the 3rd-party CD. The source is available (don’t know where though) so you should be able to figure how the get the information.
I also think this is described in Robert’s Kertn Cook book.
Thanks, maschoen and mario, for your replies!
Someone told me about the QNX System Profiler that is a part of the QNX Momentics IDE. Using that with the instrumented kernel (or instrumented microkernel, depending on the documentation) looks like it will give me what I’m looking for - at least for the CPU usage. Also found out that since memory is allocated to processes rather than threads, memory usage can’t be broken down by thread usage; so total process usage it will be!
BTW, 3rd party CD image is available at qnx.com/download/feature.html?programid=9978
The system profiler is available in the Momentic PE or during the 30 days evalutation of Momentics.