I am seeing intermittent errors from it:
[10/Mar/2003:23:15:58][1332.816][-conn:intranet::2] Error: can't read
"timewas": no such variable
can't read "timewas": no such variable
    while executing
"if {$timewas != 0 } {

set page [ns_conn url]

set conntime [expr [clock clicks] - $timewas]

                if {[nsv..."
    (procedure "EndTime" line 9)
    invoked from within
"EndTime trace"

and I'm not sure how this can be happening.

Any thoughts anyone?

I am the author of that article and also came across that problem. Since the code is mainly useful as a general guide I wasn't too worried about the issue I simple changed the offended code to:

if {[info exists timewas] && $timewas != 0} {

That got rid of that problem for me.
I am also curious as to how it was possible but haven't tracked
down the reason. There is at least one race condition also in the code
Instead of holding the # of hits in the nsv pagestat variable I moved it
to its own nsv .... The reason for this is if the server is under
heavy load and multiple people are accessing the same page at exactly
the same time while you are mucking with the pagestat variable you
may lose a few incr on the hits so you change it to

scan [nsv_get pagestat $page] {%s%s%s%s%s} laststamp lastconn min max avg
set hits [nsv_get pagecount $page]

and make the else {
   set pstat "[ns_time] $conntime $conntime $conntime $conntime



Being able to get to the next level of profiling information is crucial
though -  you want to be able to find out
why a slow page/URL detected by the above is so slow and stepping down to
command level profiling at that point is useful.

There's lots of goodies in tcllib (The Standard Tcl Library) including a
pure Tcl profiling module.
I don't think it offers the real/cpu timing breakdown, but its a step in
the
right direction and may offer enough information.

Quite what would be required to get it working I'm not sure - I guess
turning it on at initialization and writing some pages that extract and
present the data collected.



AOLserver 3.5 had profiling at URL level and Tcl command level built in.
This has disappeared in 4.x
Was this intentional?


Remember that all this profiling comes at a cost and should probably be used judiciously on a production server or for short periods of time.

Best Regards,
Carl

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


-- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/

Reply via email to