tele5.tcl
Does not contain a contract.
- Location:
- /packages/acs-subsite/www/admin/system/tele5.tcl
Related Files
[ hide source ] | [ make this the default ]
File Contents
set lines 50 set opercall {} set percount {} set peropen {} set perwait {} set perclose {} set text "" # if {"" ne [info commands throttle*] } { # append text "<h3>Throttle Statistics</h3>\n [throttle statistics] <br>\n" # } # # append text "<table border=1>" # append text "<tr><th></th><th>Current</th><th width=30%>Trend</th><th>Max</th></tr>" # foreach t {seconds minutes hours} { # append text "<tr><td>Views per<br>$t</td>" # set last [throttleThread do $t set last] # append text "<td><font size=-2>[lindex $last 0]<br>[lindex $last 1]</font></td>" # append text "<td><font size=-2>[throttleThread do $t set trend]</font></td><td><table>" # foreach v [throttleThread do $t set stats] { # switch $t { # minutes {set rps "([format %5.2f [expr {[lindex $v 1]/60.0}]] rps)"} # hours {set rps "([format %5.2f [expr {[lindex $v 1]/(60*60.0)}]] rps)"} # default {set rps ""} # } # append text "<tr><td><font size=-2>[lindex $v 0]</font></td> # <td><font size=-2>[lindex $v 1] $rps</font></td></tr>" # } # append text "</td></table></tr>" # } # append text "</table><p>" set sumTime 0 set sumCnt 0 append text "<h3>Request Statistics</h3><table border=1>\n" foreach e [lsort [ns_server urlstats]] { lassign $e fn list lassign $list cnt ws wms os oms cs cms if { [string first "/image" $fn] != -1 || [string first "statistics" $fn] != -1 } { continue } # append text "+++ [list $fn $cnt $ws $wms $os $oms $cs $cms]<br>" set o [format %9.2f [expr {$os+$oms/1000000.0}]] set c [format %9.2f [expr {$cs+$cms/1000000.0}]] set w [format %9.2f [expr {$ws+$wms/1000000.0}]] set t [format %9.2f [expr {$o+$c+$w}]] set open [format %9.2f [expr {$o/$cnt}]] set wait [format %9.2f [expr {$w/$cnt}]] set close [format %9.2f [expr {$c/$cnt}]] set total [format %9.2f [expr {$t/$cnt}]] lappend all [list [format %8d $cnt] $fn $wait $open $close $total] set sumTime [expr {$sumTime+$t}] set sumCnt [expr {$sumCnt+$cnt}] # lappend tpercall [list [format %10.3f [expr {$t/$cnt}]] $fn $cnt $w $o $c $t] # lappend opercall [list [format %10.3f [expr {$o/$cnt}]] $fn $cnt $w $o $c] # lappend wpercall [list [format %10.3f [expr {$w/$cnt}]] $fn $cnt $w $o $c] # lappend cpercall [list [format %10.3f [expr {$c/$cnt}]] $fn $cnt $w $o $c] # lappend percount [list [format %8d $cnt] $fn $w $o $c $t] # lappend peropen [list $o $cnt $fn $w $c] # lappend perwait [list $w $cnt $fn $o $c] # lappend perclose [list $c $cnt $fn $o $w] } append text "<tr><td>Filename</td><td>Count</td><td>Wait</td><td>Open</td><td>Close</td><td>Total</td></tr>" foreach runner [lsort -decreasing $all] { lassign $runner cnt fn wait open close total append text "<tr><td>$fn</td><td>$cnt</td><td>$wait</td><td>$open</td><td>$close</td><td>$total</td></tr>" } append text "</table><br>Total Reqs: $sumCnt Avg response time: [format %7.2f [expr {$sumTime/$sumCnt}]]<p>\n" # # set i 0 # append text "<table>" # append text "<tr><th>count</th><th>url</th><th>wait</th><th>open</th><th>close</th><th>response time</th></tr>\n" # foreach l [lsort -decreasing $percount] { # if {[incr i]>$lines} break # lassign $l cnt fn w o c t # append text "<tr><td align=right>$cnt</td><td>$fn</td><td align=right>$w</td><td align=right>$o</td><td align=right>$c</td><td align=right>[format %5.2f [expr {$t/$cnt}]]</td></tr>\n" # } # append text \n</table><p>\n # # set i 0 # append text "<table>" # append text "<tr><th>total per call</th><th>url</th><th>count</th><th>wait</th><th>open</th><th>close</th><th>total</th></tr>\n" # foreach l [lsort -decreasing $tpercall] { # if {[incr i]>$lines} break # lassign $l exp fn cnt w o c t # append text "<tr><td align=right>$exp</td><td>$fn</td><td align=right>$cnt</td><td align=right>$w</td><td align=right>$o</td><td align=right>$c</td><td align=right>$t</td></tr>\n" # } # append text \n</table><p>\n # # set i 0 # append text "<table>" # append text "<tr><th>open</th><th>count</th><th>url</th><th>wait</th><th>close</th></tr>\n" # foreach l [lsort -decreasing $peropen] { # if {[incr i]>$lines} break # lassign $l o cnt fn w c # append text "<tr><td align=right>$o</td><td align=right>$cnt</td><td>$fn</td><td align=right>$w</td><td align=right>$c</td></tr>\n" # } # append text \n</table><p>\n # # set i 0 # append text "<table>" # append text "<tr><th>open per call</th><th>url</th><th>count</th><th>wait</th><th>open</th><th>close</th></tr>\n" # foreach l [lsort -decreasing $opercall] { # if {[incr i]>$lines} break # lassign $l exp fn cnt w o c # append text "<tr><td align=right>$exp</td><td>$fn</td><td align=right>$cnt</td><td align=right>$w</td><td align=right>$o</td><td align=right>$c</td></tr>\n" # } # append text \n</table><p>\n # # # set i 0 # append text "<table>" # append text "<tr><th>wait</th><th>count</th><th>url</th><th>open</th><th>close</th></tr>\n" # foreach l [lsort -decreasing $perwait] { # if {[incr i]>$lines} break # lassign $l w cnt fn o c # append text "<tr><td align=right>$w</td><td align=right>$cnt</td><td>$fn</td><td align=right>$o</td><td align=right>$c</td></tr>\n" # } # append text \n</table><p>\n # # set i 0 # append text "<table>" # append text "<tr><th>wait per call</th><th>url</th><th>count</th><th>wait</th><th>open</th><th>close</th></tr>\n" # foreach l [lsort -decreasing $wpercall] { # if {[incr i]>$lines} break # lassign $l exp fn cnt w o c # append text "<tr><td align=right>$exp</td><td>$fn</td><td align=right>$cnt</td><td align=right>$w</td><td align=right>$o</td><td align=right>$c</td></tr>\n" # } # append text \n</table><p>\n # # set i 0 # append text "<table>" # append text "<tr><th>close</th><th>count</th><th>url</th><th>open</th><th>wait</th></tr>\n" # foreach l [lsort -decreasing $perclose] { # if {[incr i]>$lines} break # lassign $l c cnt fn o w # append text "<tr><td align=right>$c</td><td align=right>$cnt</td><td>$fn</td><td align=right>$o</td><td align=right>$w</td></tr>\n" # } # append text \n</table><p>\n # # set i 0 # append text "<table>" # append text "<tr><th>close per call</th><th>url</th><th>count</th><th>wait</th><th>open</th><th>close</th></tr>\n" # foreach l [lsort -decreasing $cpercall] { # if {[incr i]>$lines} break # lassign $l exp fn cnt w o c # append text "<tr><td align=right>$exp</td><td>$fn</td><td align=right>$cnt</td><td align=right>$w</td><td align=right>$o</td><td align=right>$c</td></tr>\n" # } # append text \n</table><p>\n # ns_return 200 text/html $text