new-host$ cat ./tclstat3.tcl
#!/apps/tcl/bin/tclsh8.6
puts "r b w freememG pagin-out cpu-us-sy-id contextswitches"
while {1} {
set raw [exec vmstat -c 3]
set rawsplit [split $raw "\n"]
set raw5 [lindex $rawsplit 4]
set proc [lrange $raw5 0 2]
set freemem [expr [lindex $raw5 4] / 1048576.0]
set nicemem [format %.2f $freemem]
set pageinout [lrange $raw5 7 8]
set ussysid [lrange $raw5 16 18]
set cswitch [lindex $raw5 15]
puts "$proc $nicemem $pageinout $ussysid $cswitch"
}
Tuesday, March 29, 2011
tcl vmstat
tclstat3.tcl
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment