Finding resource usage (cpu and memory) by threads of a process in unix (solaris / linux)

I have a multi-threaded application (C ++ and pthread library) and I would be interested to know how much resources (CPU and memory) each thread uses. Is there a way to find out this information about Solaris and Linux as for any of them.

+2


source to share


1 answer


You can 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


See the ps man page for some information (LWP (lightweight process))

+6


source







All Articles