Index: openacs-4/packages/acs-developer-support/acs-developer-support.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/acs-developer-support.info,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-developer-support/acs-developer-support.info 13 Jan 2005 13:55:19 -0000 1.17 +++ openacs-4/packages/acs-developer-support/acs-developer-support.info 4 Feb 2005 13:34:39 -0000 1.18 @@ -8,30 +8,31 @@ t ds - + Lars Pind Profiling for requests including database timing information. - 2003-11-10 + 2005-02-04 OpenACS Developer support stores timing and other logged information for requests to support debugging and tuning and supports user switching and a Tcl Shell to invoke arbitrary tcl code on the server. 0 - - + + - + + Index: openacs-4/packages/acs-developer-support/lib/footer.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/lib/footer.adp,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-developer-support/lib/footer.adp 3 Feb 2005 23:22:20 -0000 1.11 +++ openacs-4/packages/acs-developer-support/lib/footer.adp 4 Feb 2005 13:34:39 -0000 1.12 @@ -29,20 +29,33 @@

Profiling Information

+ + - + + +
Ops Tag # Iterations Total time Avg. time per iterationSize
@profiling.file_links;noquote@ @profiling.tag@@profiling.file_links;noquote@@profiling.tag@ @profiling.num_iterations@ @profiling.total_ms@ ms @profiling.ms_per_iteration@ ms@profiling.size@
+ +

+

+ + + +
+

+ Index: openacs-4/packages/acs-developer-support/lib/footer.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/lib/footer.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-developer-support/lib/footer.tcl 13 Jan 2005 13:55:19 -0000 1.7 +++ openacs-4/packages/acs-developer-support/lib/footer.tcl 4 Feb 2005 13:34:39 -0000 1.8 @@ -3,9 +3,12 @@ # TODO: Go through request-processor to see what other information should be exposed to developer-support # TODO: Always show comments inline by default? +set request [ad_conn request] if { $show_p } { + set page_fragment_cache_p [ds_page_fragment_cache_enabled_p] + set ds_url [ds_support_url] #set comments_p [ds_comments_p] @@ -86,23 +89,48 @@ } # Profiling information - global ds_profile__total_ms ds_profile__iterations + global ds_profile__total_ms ds_profile__iterations - multirow create profiling tag num_iterations total_ms ms_per_iteration file_links + multirow create profiling tag num_iterations total_ms ms_per_iteration file_links size if { [info exists ds_profile__total_ms] } { - foreach tag [lsort [array names ds_profile__total_ms]] { - if {[file exists $tag]} { - set file_links "e c" - } else { + foreach tag [lsort [array names ds_profile__iterations]] { + if {[file exists $tag]} { + set file_links "e" + append file_links " c" + } else { set file_links {} } - multirow append profiling $tag [set ds_profile__iterations($tag)] [lc_numeric [set ds_profile__total_ms($tag)]] \ - [ad_decode [set ds_profile__iterations($tag)] 0 {} \ - [lc_numeric [expr [set ds_profile__total_ms($tag)]/[set ds_profile__iterations($tag)]]]] \ - $file_links + if { $page_fragment_cache_p } { + if { [string match *.adp $tag]} { + append file_links " o" + if {[ns_cache get ds_page_bits "$request:$tag" dummy]} { + set size [string length $dummy] + } else { + set size {?} + } + } else { + append file_links " x" + set size - + } + } else { + set size {} + } + + if {[info exists ds_profile__total_ms($tag)]} { + set total_ms [lc_numeric [set ds_profile__total_ms($tag)]] + if {[info exists ds_profile__iterations($tag)] + && $ds_profile__iterations($tag) > 0} { + set ms_per_iteration [lc_numeric [expr {1.0*$ds_profile__total_ms($tag)/$ds_profile__iterations($tag)}]] + } else { + set ms_per_iteration - + } + } else { + set total_ms - + set ms_per_iteration - + } + multirow append profiling $tag [set ds_profile__iterations($tag)] $total_ms $ms_per_iteration $file_links $size } } - } Index: openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl 4 May 2004 20:51:38 -0000 1.5 +++ openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl 4 Feb 2005 13:34:40 -0000 1.6 @@ -14,21 +14,28 @@ # Take the IP list (space or comma seperated) and turn it into a tcl list. set IPs [list] - foreach ip [split [ad_parameter -package_id [ds_instance_id] EnabledIPs acs-developer-support *] { ,}] { - if {[string equal $ip "*"]} { + foreach ip [lsort -unique [split [ad_parameter -package_id [ds_instance_id] EnabledIPs acs-developer-support *] { ,}]] { + if {[string equal $ip "*"]} { # a star means anything will match so just use the * instead set IPs "*" break - } elseif {![empty_string_p $ip]} { + } elseif {![empty_string_p $ip]} { lappend IPs $ip } } nsv_set ds_properties enabled_ips $IPs nsv_set ds_properties database_enabled_p [ad_parameter -package_id [ds_instance_id] DatabaseEnabledP developer-support 0] + nsv_set ds_properties adp_reveal_enabled_p [ad_parameter -package_id [ds_instance_id] AdpRevealEnabledP developer-support 0] + + nsv_set ds_properties page_fragment_cache_p [ad_parameter -package_id [ds_instance_id] PageFragmentCacheP developer-support 0] + ds_set_user_switching_enabled [ad_parameter -package_id [ds_instance_id] UserSwitchingEnabledP acs-developer-support 0] + + # JCD: used to cache rendered page bits. cap at 10mb for now. + ns_cache create ds_page_bits -size 10000000 } ds_watch_packages Index: openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl,v diff -u -r1.38 -r1.39 --- openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 3 Feb 2005 11:42:29 -0000 1.38 +++ openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 4 Feb 2005 13:34:40 -0000 1.39 @@ -90,6 +90,12 @@ return [nsv_get ds_properties database_enabled_p] } +ad_proc -public ds_page_fragment_cache_enabled_p {} { o + Are we populating the page fragment cache? +} { + return [nsv_get ds_properties page_fragment_cache_p] +} + ad_proc -public ds_adp_reveal_enabled_p {} { Returns true if developer-support adp revealing facilities are enabled. } { @@ -629,19 +635,19 @@ error "Tag parameter is required" } set ds_profile__start_clock($tag) [clock clicks -milliseconds] + set ds_profile__iterations($tag) 0 } stop { if { ![empty_string_p $ds_profile__start_clock($tag)] } { set num_ms [expr [clock clicks -milliseconds] - $ds_profile__start_clock($tag)] - set ds_profile__start_clock($tag) {} + unset ds_profile__start_clock($tag) if { ![info exists ds_profile__total_ms($tag)] } { set ds_profile__total_ms($tag) 0 - set ds_profile__iterations($tag) 0 } set ds_profile__total_ms($tag) [expr [set ds_profile__total_ms($tag)] + $num_ms] - set ds_profile__iterations($tag) [expr [set ds_profile__iterations($tag)] + 1] + incr ds_profile__iterations($tag) } else { ns_log Error "ds_profile stop called without a corresponding call to ds_profile start, with tag $tag" } Index: openacs-4/packages/acs-developer-support/www/request-info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/request-info.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-developer-support/www/request-info.adp 29 Jan 2004 12:02:46 -0000 1.3 +++ openacs-4/packages/acs-developer-support/www/request-info.adp 4 Feb 2005 13:34:40 -0000 1.4 @@ -2,6 +2,15 @@ @page_title;noquote@ @context;noquote@ + +

+

+ + + +
+

+ @body;noquote@ 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.11 -r1.12 --- openacs-4/packages/acs-developer-support/www/request-info.tcl 3 Feb 2005 11:42:29 -0000 1.11 +++ openacs-4/packages/acs-developer-support/www/request-info.tcl 4 Feb 2005 13:34:40 -0000 1.12 @@ -23,6 +23,8 @@ } } +set page_fragment_cache_p [ds_page_fragment_cache_enabled_p] + if { [info exists property(start)] } { append body "

Parameters

Index: openacs-4/packages/acs-developer-support/www/search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/search.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-developer-support/www/search.adp 4 Feb 2005 13:34:40 -0000 1.1 @@ -0,0 +1,20 @@ + + Search + @context;noquote@ + +

+ + + + +

@matches.file_links;noquote@ @matches.page@ @matches.size@ bytes

@matches.excerpt@
+
+
+ +

No match

+
+
+ +

That request is invalid or has expired from the cache.

+
+ \ No newline at end of file Index: openacs-4/packages/acs-developer-support/www/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/search.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-developer-support/www/search.tcl 4 Feb 2005 13:34:40 -0000 1.1 @@ -0,0 +1,35 @@ +ad_page_contract { + return x-editlocal or the code for the compiled function + + @author Jeff Davis + @creation-date 2005-02-02 + @cvs-id $Id: search.tcl,v 1.1 2005/02/04 13:34:40 jeffd Exp $ +} { + request:integer,notnull + expression:notnull +} + +set context [list [list request-info?request=$request "request $request"] search] + +if {![ns_cache get ds_page_bits $request pages]} { + set gone_p 1 +} else { + set gone_p 0 + + multirow create matches page excerpt file_links size + + foreach page $pages { + if {![info exists matched($page)] + && [ns_cache get ds_page_bits $request:$page content]} { + if {[regexp -indices $expression $content offset]} { + set file_links "e" + append file_links " c" + append file_links " o" + set size [string length $content] + + multirow append matches $page "...[string trim [string range $content [expr [lindex $offset 0] - 50] [expr [lindex $offset 1] + 50]]]..." $file_links $size + } + set matched($page) 1 + } + } +} Index: openacs-4/packages/acs-developer-support/www/send.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/send.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-developer-support/www/send.tcl 1 Apr 2004 15:04:38 -0000 1.1 +++ openacs-4/packages/acs-developer-support/www/send.tcl 4 Feb 2005 13:34:40 -0000 1.2 @@ -3,6 +3,7 @@ } { {fname:trim {}} {code:trim {}} + {output:trim {}} } if {![empty_string_p $code]} { @@ -11,6 +12,13 @@ } else { ns_returnfile 200 text/plain $code } -} else { +} elseif {![empty_string_p $fname]} { ns_return 200 application/x-editlocal [ns_set get [ns_conn form] fname] +} elseif {![empty_string_p $output]} { + if {[ns_cache get ds_page_bits $output content]} { + ns_return 200 text/plain "Size: [string length $content]\n\n------------------------------------------------------------\n$content" + } else { + ns_return 200 text/plain "Output for $output has expired" + } } +