G''Day Folks,
Well, this one was my white whale. I now have a demonstration program
that uses Perl, Kstat, /proc/*/usage, /proc/*/psinfo, and DTrace.
The program itself is more of a prototype, I want to get serious about it
and rewrite it in C. It currently has output like,
# prustat -t5 -snet 10
PID %CPU %Mem %Disk %Net COMM
90 0.00 0.09 0.00 0.00 syseventd
443 0.00 0.13 0.00 0.00 snmpd
102 0.00 0.00 0.00 0.00 picld
10096 0.00 0.35 0.00 0.00 bash
445 0.00 0.00 0.00 0.00 dtlogin
PID %CPU %Mem %Disk %Net COMM
22554 0.00 0.00 2.83 11.76 rcp
22553 0.00 0.00 2.43 11.47 rcp
4789 1.17 0.45 0.00 0.20 vncviewer
440 4.89 45.39 0.00 0.00 Xsun
90 0.00 0.09 0.00 0.00 syseventd
PID %CPU %Mem %Disk %Net COMM
4789 0.82 0.45 0.00 0.02 vncviewer
12047 0.01 0.13 0.00 0.01 rlogin
440 8.94 45.39 0.00 0.00 Xsun
12046 0.00 0.27 0.00 0.00 rlogin
90 0.00 0.09 0.00 0.00 syseventd
^C
Wheee, I can see rcp''s %Net and %Disk! (oh, and it probably died too
soon
before I /proc/*/psinfo pr_pctcpu''d it. Not to worry, if it missed
sampling then it would be unlikely to have had huge values there anyway
(especially considering pr_pctcpu''s averaging algorithm over
time)))....
It''s on my dtrace site (http://www.brendangregg.com/DTrace/prustat).
It can also do a prstat style of refresh output, and other stuff.
# prustat -h
prustat ver 0.50, demo release
USAGE: prustat [-cehinuwxz] [-p PID] [-s sort] [-t top] [interval] [count]
prustat # %Utilisation
prustat -i # + I/O stats
prustat -u # + USR/SYS times
prustat -x # + Context Switchs
prustat -c # Clear screen
prustat -w # Wide output
prustat -z # Skip zero lines
prustat -e # Extra precision
prustat -p PID # this PID only
prustat -s sort # sort on pid|cpu|mem|disk|net|utime|vctx|...
prustat -t lines # print top number of lines only
eg,
prustat 2 # 2 second samples (first is historical)
prustat 10 5 # 5 x 10 second samples
prustat -t 8 10 5 # 5 x 10 second samples, top 8 lines only
prustat -ct 20 5 # 20 lines with screen refresh each 5 seconds
prustat -iuxct 5 10 # multi output, all reports every 10 seconds
prustat -ct 22 -s cpu 5 # 22 lines, sort by cpu, every 5 secs
prustat -ct 22 -s mem 5 # 22 lines, sort by mem, every 5 secs
prustat -ct 22 -s net 5 # 22 lines, sort by network, by disk, every 5
secs
...
My performance obsession also led me to write sysperfstat last
night/morning,
$ sysperfstat 1
------ Utilisation ------ ------ Saturation ------
Time %CPU %Mem %Disk %Net CPU Mem Disk Net
23:41:01 3.00 79.41 0.00 0.00 0.00 0.00 0.00 0.00
23:41:02 32.00 79.69 1.29 8.40 0.00 0.00 0.00 0.00
23:41:03 55.00 80.12 25.15 65.40 0.00 0.00 0.01 0.00
23:41:04 63.00 80.42 22.02 82.53 0.00 0.00 0.01 0.00
23:41:05 82.00 80.64 44.74 84.22 0.00 0.00 0.07 0.00
23:41:06 88.00 80.85 41.31 86.41 2.00 0.00 0.05 0.00
23:41:07 74.00 81.04 48.37 86.16 0.00 0.00 0.05 0.00
23:41:08 75.00 81.06 74.18 84.34 3.00 0.00 0.24 0.00
23:41:09 47.00 80.78 18.59 82.96 0.00 0.00 0.00 0.00
23:41:10 13.00 80.64 0.00 18.79 1.00 0.00 0.00 0.00
but that''s only Kstat so it''s not as cool. :)
Brendan
[Sydney, Australia]
_______________________________________________
DTrace mailing list
DTrace@opensolaris.org
https://www.opensolaris.org/mailman/listinfo/dtrace