Index: openacs-4/packages/xotcl-request-monitor/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/index.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/xotcl-request-monitor/www/index.tcl 6 Dec 2012 11:43:17 -0000 1.20 +++ openacs-4/packages/xotcl-request-monitor/www/index.tcl 20 Dec 2012 15:38:47 -0000 1.21 @@ -255,6 +255,11 @@ set background [expr {[llength $background_requests]/2}] append running /$background } +if {[ns_info name] eq "NaviServer"} { + # add info from background writer + append running /[llength [ns_writer list]] +} + array set thread_avgs [throttle thread_avgs] if {[info command ::tlf::system_activity] ne ""} { Index: openacs-4/packages/xotcl-request-monitor/www/running.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/running.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/xotcl-request-monitor/www/running.tcl 16 Sep 2008 09:32:59 -0000 1.5 +++ openacs-4/packages/xotcl-request-monitor/www/running.tcl 20 Dec 2012 15:38:47 -0000 1.6 @@ -26,7 +26,13 @@ } set nr_bg [expr {[llength $background_requests]/2}] set nr_req [expr {[llength $running_requests]/2}] -set title "Currently Running Requests ($nr_req/$nr_bg)" +set counts $nr_req/$nr_bg +if {[ns_info name] eq "NaviServer"} { + set writer_requests [ns_writer list] + append counts /[llength $writer_requests] +} + +set title "Currently Running Requests ($counts)" set context [list "Running Requests"] TableWidget create t1 -volatile \ @@ -38,12 +44,13 @@ Field url -label "Url" Field elapsed -label "Elapsed Time" -html { align right } Field background -label "Background" + Field progress -label "Progress" } \ -no_data "Currently no running requests" set sortable_requests [list] foreach {key elapsed} $running_requests { - foreach {requestor url} [split $key ,] break + lassign [split $key ,] requestor url set ms [format %.2f [expr {[throttle ms -start_time $elapsed]/1000.0}]] if {[string is integer $requestor]} { acs_user::get -user_id $requestor -array user @@ -55,25 +62,44 @@ lappend sortable_requests [list $user_string $user_url $url $ms ""] } foreach {index entry} $background_requests { - foreach {key elapsed} $entry break - foreach {requestor url} [split $key ,] break - set ms [format %.2f [expr {[throttle ms -start_time $elapsed]/1000.0}]] + lassign $entry key elapsed + lassign [split $key ,] requestor url + set ms [format %.2f [expr {[throttle ms -start_time $elapsed]/-1000.0}]] if {[string is integer $requestor]} { acs_user::get -user_id $requestor -array user set user_string "$user(first_names) $user(last_name)" } else { set user_string $requestor } set user_url "last-requests?request_key=$requestor" - lappend sortable_requests [list $user_string $user_url $url -$ms "background"] + lappend sortable_requests [list $user_string $user_url $url $ms "::bgdelivery"] } +if {[ns_info name] eq "NaviServer"} { + foreach {entry} $writer_requests { + if {[llength $entry] != 8} continue + lassign $entry starttime thread driver ip fd remaining done clientdata + lassign $clientdata requestor url + set size [expr {$remaining+$done}] + set percentage [expr {$done*100.0/$size}] + set progress [format {%5.2f%% of %5.2f MB} $percentage [expr {$size/1000000.0}]] + set ms [format %.2f [expr {([clock milliseconds] - $starttime*1000)/-1000.0}]] + if {[string is integer $requestor]} { + acs_user::get -user_id $requestor -array user + set user_string "$user(first_names) $user(last_name)" + } else { + set user_string $requestor + } + set user_url "last-requests?request_key=$requestor" + lappend sortable_requests [list $user_string $user_url $url $ms $thread $progress] + } +} foreach r [lsort -decreasing -real -index 3 $sortable_requests] { - foreach {user_string user_url url ms mode} $r break + lassign $r user_string user_url url ms mode progress if {$ms<0} {set ms [expr {-1*$ms}]} t1 add \ -user $user_string -user.href $user_url \ - -url $url -elapsed $ms -background $mode + -url $url -elapsed $ms -background $mode -progress $progress } set t1 [t1 asHTML]