On Thu, Jan 7, 2010 at 7:57 AM, Chad Mynhier <cmynh...@gmail.com> wrote:
> On Thu, Jan 7, 2010 at 8:44 AM, Paul <paul.mad...@swx.com> wrote:
>> I have no problem finding, from with a "C" app, my process utilization.
>>
>> I need now to dig deeper and extract internally to the app the CPU 
>> utilisztion of each thread within my app
>>
>> Any help, better still source fragment, would be much appreciated
>
> prstat(1M) gives you per-thread statistics with the -L option.  That
> would probably be a good place to start:
>
> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/prstat/

Note that prstat -L will give you CPU performance data that is time
decayed and the % is over all of the CPU's in the system.  That is, if
you are on a T5240 with 2 x 8 core CPU's, this will be seen as 128
CPU's to solaris.  A thread that spends 100% of its time on CPU will
show up as using < 1% CPU.

When I am looking at process CPU utilization statistics, I use prstat
-mL.  The following output from prstat -mLcn 3 gives microstate CPU
utilization statistics for the 3 busiest threads.

Total: 47 processes, 196 lwps, load averages: 0.15, 0.14, 0.13
   PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID
  1221 root     2.0 0.6 0.0 0.0 0.0 0.0  97 0.0  98   3  2K   0 pkg/1
  1288 root     0.0 0.2 0.0 0.0 0.0 0.0 100 0.0   4   1 163   0 prstat/1
   859 jack     0.1 0.1 0.0 0.0 0.0 0.0 100 0.0  23   1 304   0 sshd/1
Total: 47 processes, 196 lwps, load averages: 0.15, 0.14, 0.13
   PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID
  1221 root     1.1 0.4 0.0 0.0 0.0 0.0  99 0.0  65   4  1K   0 pkg/1
  1288 root     0.0 0.2 0.0 0.0 0.0 0.0 100 0.0   4   0 163   0 prstat/1
   859 jack     0.0 0.0 0.0 0.0 0.0 0.0 100 0.0  17   1 192   0 sshd/1
Total: 47 processes, 196 lwps, load averages: 0.14, 0.13, 0.13

With the -m output, 100% means 100% of a single CPU (or core or strand
as appropriate).

-- 
Mike Gerdts
http://mgerdts.blogspot.com/
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to