I have a multi-threaded application(C++ and pthread library) and I will like to know how much resources(CPU and memory) each thread uses. Is there a way to find out these details on Solaris and Linux both or on either of them.
views:
368answers:
1
+2
A:
Hi,
You could use the ps command with some option:
ps -eLo pid,ppid,lwp,nlwp,osz,rss,ruser,pcpu,stime,etime,args | more PID PPID LWP NLWP SZ RSS RUSER %CPU STIME ELAPSED COMMAND 0 0 1 1 0 0 root 0.0 Oct_02 4-02:13:37 sched 1 0 1 1 298 528 root 0.0 Oct_02 4-02:13:36 /sbin/init 2 0 1 1 0 0 root 0.0 Oct_02 4-02:13:36 pageout
Have a look at the ps man's page to get some information (LWP (light weight process))
Arnaud
2009-10-06 15:52:24
Is LWP a thread? I mean in Linux/Solaris terms. Since in what you have pasted here PPID is 0, I suppose that its a process and not a thread. Am I correct?
mkamthan
2009-10-07 06:03:33
Yes. LWP is a thread. http://www.theeggeadventure.com/wikimedia/index.php/What_is_NLWP_on_Solaris%3F
brianegge
2009-10-20 05:38:57