Index: openacs-4/packages/acs-developer-support/www/request-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/request-info.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-developer-support/www/request-info.tcl 11 Jan 2004 16:35:55 -0000 1.6 +++ openacs-4/packages/acs-developer-support/www/request-info.tcl 14 Jan 2004 08:58:34 -0000 1.7 @@ -4,9 +4,11 @@ # Description: Displays information about a page request. # Inputs: request -ad_page_variables { +ad_page_contract { +} { request - { rp_show_debug_p 0 } + {rp_show_debug_p 0} + {getrow_p:boolean "f"} } ds_require_permission [ad_conn package_id] "admin" @@ -196,25 +198,16 @@ } if { [info exists property(db)] } { - append body "

Database Requests

-
- -\n" + multirow create dbreqs handle command sql duration_ms value - set colors { #DDDDDD #FFFFFF } - - set total 0 - - set counter 0 foreach { handle command statement_name sql start end errno return } $property(db) { - set bgcolor [lindex $colors [expr { $counter % [llength $colors] }]] if { ![empty_string_p $handle] && [info exists pool($handle)] } { set statement_pool $pool($handle) } else { set statement_pool "" } - + if { $command == "gethandle" } { # Remember which handle was acquired from which pool. set statement_pool $sql @@ -228,15 +221,47 @@ } else { set value "$statement_name: " } - append value "$command $handle
[ns_quotehtml $sql]
\n" + + # TODO: Remove extra whitespace before query + + append value "$command $handle
[ns_quotehtml $sql]
" } - append body "\n" - incr counter + if { ![string equal $command "getrow"] || [template::util::is_true $getrow_p] } { + multirow append dbreqs $handle $command $sql [expr { $end - $start }] $value + } - incr total [expr { $end - $start }] } - append body "\n" - append body "
  Duration    Pool  Command
  [format "%.f" [expr { ($end - $start) }]] ms    $statement_pool  $value
  [format "%.f" [expr { $total }]] ms  (total)
\n" + + # TODO: Sort by duration, so you can see slowest queries at top + template::list::create \ + -name dbreqs \ + -elements { + duration_ms { + label "Duration" + html { align right } + display_template {@dbreqs.duration_ms@ ms} + aggregate sum + } + command { + label "Command" + } + sql { + label "SQL" + aggregate_label "Total Duration (ms)" + display_template {@dbreqs.value;noquote@} + } + } -filters { + getrow_p { + label "Getrow" + values { + {"Include" t} + {"Exclude" f} + } + default_value t + } + request {} + } + }