Request Start Time: | [clock format [lindex $property(start) 0] -format "%Y-%m-%d %H:%M:%S"]\n"
+
+
+ Request Start Time: | [clock format [lindex $property(start) 0] \
+ -format "%Y-%m-%d %H:%M:%S"]
+ }]
} else {
set expired_p 1
- append body "The information for this request is gone - either the server has been restarted, or
-the request is more than [parameter::get -parameter DeveloperSupportLifetime -default 900] seconds old.
-[ad_admin_footer]"
+ append body [subst {
+ The information for this request is gone - either the server has been restarted, or
+ the request is more than [parameter::get -parameter DeveloperSupportLifetime -default 900] seconds old.
+ }]
return
}
if { [info exists property(conn)] } {
- array set conn $property(conn)
foreach { key name } {
end {Request Completion Time}
@@ -58,62 +60,60 @@
validated {Session Validation}
error {Error}
} {
- if { [info exists conn($key)] } {
+ if { [dict exists $property(conn) $key] } {
+ set raw [dict get $property(conn) $key]
switch $key {
error {
- set value "[ns_quotehtml $conn($key)] "
+ set value "[ns_quotehtml $raw] "
}
endclicks {
- set value "[format "%.f" [expr { ($conn(endclicks) - $conn(startclicks)) }]] ms"
+ set value [format "%.f ms" [expr { $raw/1000.0 - [dict get $property(conn) startclicks] }]]
}
end {
- set value [clock format $conn($key) -format "%Y-%m-%d %H:%M:%S" ]
+ set value [clock format $raw -format "%Y-%m-%d %H:%M:%S"]
}
user_id {
- if { [db_0or1row user_info "
+ if { [db_0or1row user_info {
select first_names, last_name, email
from users
- where user_id = $conn(user_id)
- "] } {
- set value "
-$conn(user_id):
-$first_names $last_name (mailto:$email)
-"
+ where user_id = :raw
+ }] } {
+ set value [subst {
+ $raw:
+ $first_names $last_name (mailto:$email)
+ }]
} else {
- set value $conn(user_id)
+ set value $raw
}
}
default {
- set value [ns_quotehtml $conn($key)]
+ set value [ns_quotehtml $raw]
}
}
- append body " |
---|
$name: | [ad_decode $value "" "(empty)" $value] | \n"
+ append body [subst {
+ $name: | [ad_decode $value "" "(empty)" $value] |
+ }]
}
}
}
append body " "
if { [info exists property(rp)] } {
- append body "
-Request Processor
-
-"
+ append body [subst {
+ Request Processor
+
+ }]
foreach rp $property(rp) {
- set kind [lindex $rp 0]
- set info [lindex $rp 1]
- set startclicks [lindex $rp 2]
- set endclicks [lindex $rp 3]
- set action [lindex $rp 4]
- set error [lindex $rp 5]
+ lassign $rp kind info startclicks endclicks action error
- set duration "[format "%.1f" [expr { ($endclicks - $startclicks) }]] ms"
-
- if { [string equal $kind debug] && !$rp_show_debug_p } {
+ if { $kind eq "debug" && !$rp_show_debug_p } {
continue
}
+ set duration [format "%.1f ms" [expr { $endclicks - $startclicks }]]
+
if { [info exists conn(startclicks)] } {
append body "- [format "%+06.1f" [expr { ($startclicks - $conn(startclicks)) }]] ms: "
} else {
@@ -122,42 +122,34 @@
switch $kind {
transformation {
- set proc [lindex $info 0]
- set from [lindex $info 1]
- set to [lindex $info 2]
-# unlist $info proc from to
- if { [empty_string_p $to] } {
+ lassign $info proc from to
+ if { $to eq "" } {
set to "?"
}
append body "Applied transformation from $from -> $to - $duration\n"
}
filter {
- set kind [lindex $info 1]
- set method [lindex $info 2]
- set path [lindex $info 3]
- set proc [lindex $info 4]
- set args [lindex $info 5]
+ lassign $info . kind method path proc args
append body "Applied $kind filter: $proc [ns_quotehtml $args] (for $method $path) - $duration\n"
- if { [string equal $action "error"] } {
+ if {$action eq "error"} {
append body "
- returned error:
[ns_quotehtml $error] \n"
- } elseif { ![empty_string_p $action] } {
+ } elseif { $action ne "" } {
append body "\n"
}
}
registered_proc {
set proc [lindex $info 2]
set args [lindex $info 3]
append body "Called registered procedure: $proc [ns_quotehtml $args] for ($method $path) - $duration\n"
- if { [string equal $action "error"] } {
+ if {$action eq "error"} {
append body "- returned error:
[ns_quotehtml $error] \n"
}
}
serve_file {
- set file [lindex $info 0]
- set handler [lindex $info 1]
+ lassign $info file handler
append body "Served file $file with $handler - $duration\n"
- if { [string equal $action "error"] } {
+ if {$action eq "error"} {
append body "- returned error:
[ns_quotehtml $error] \n"
}
}
@@ -211,21 +203,21 @@
foreach { handle command statement_name sql start end errno return } $property(db) {
- if { ![empty_string_p $handle] && [info exists pool($handle)] } {
+ if { $handle ne "" && [info exists pool($handle)] } {
set statement_pool $pool($handle)
} else {
set statement_pool ""
}
- if { $command == "gethandle" } {
+ if { $command eq "gethandle" } {
# Remember which handle was acquired from which pool.
set statement_pool $sql
set value "gethandle (returned $return)"
set pool($return) $sql
- } elseif { $command == "releasehandle" } {
+ } elseif { $command eq "releasehandle" } {
set value "releasehandle $handle"
} else {
- if { [empty_string_p $statement_name] } {
+ if { $statement_name eq "" } {
set value ""
} else {
set value "$statement_name: "
@@ -237,7 +229,7 @@
set len [string length $line]
set trimleft_len [string length [string trimleft $line]]
if { $trimleft_len > 0 } {
- set whitespace [expr $len - $trimleft_len]
+ set whitespace [expr {$len - $trimleft_len}]
if { $min_whitespace == -1 || $whitespace < $min_whitespace } {
set min_whitespace $whitespace
}
@@ -255,13 +247,13 @@
append value "$command $statement_pool $handle[ns_quotehtml $sql] "
}
- if { ![string equal $command "getrow"] || [template::util::is_true $getrow_p] } {
- multirow append dbreqs $handle $command $sql [expr { $end - $start }] $value
+ if { $command ne "getrow" || [template::util::is_true $getrow_p] } {
+ multirow append dbreqs $handle [lindex $command 0] $sql [format %.2f [expr { $end - $start }]] $value
}
}
- multirow sort dbreqs -integer -decreasing duration_ms
+ multirow sort dbreqs -real -decreasing duration_ms
template::list::create \
-name dbreqs \
@@ -330,7 +322,7 @@
}
if { $page_fragment_cache_p } {
- if { [string match *.adp $tag]} {
+ if { [string match "*.adp" $tag]} {
append file_links " o"
if {[ns_cache get ds_page_bits "$request:$tag" dummy]} {
set size [string length $dummy]
|
---|