Forum OpenACS Q&A: Best way to time TCL pages.

Posted by Connie Hentosh on
Bob OConnor posted a question in the "Open ACS handling heavy traffic" thread. I think it got lost in the numerous posts. I was curious about the same thing, so here is his post:

What is the best way to time my dynamic tcl pages so I can clean up any 
time consuming selects and other code? 

I could do an
ns_log Notice "Start time..."
 at the beginning of the page and again just before
 ns_return 200 text/html $page_content 

Doing a
set now [database_to_tcl_string $db "select [db_sysdate] from dual"]
 May in itself add a bit of time to the test, 

Suggestions and code snippets would be helpful. 


 -- Bob OConnor, November 29, 2001 

Any good tricks out there or pointers to docs that cover this?

Posted by Don Baccus on
In the [Open]ACS 4 world, acs-developer-support will give you timings on every database operation used to build a given page - it gives a summary at the bottom of the page and a link to a page that gives details.

I don't think that backporting this to the 3.2.5 environment would be all that tough *if* you're also using the backported db api (the db api tracks the actual timing, using Tcl's "clock clicks" command, not the db).

There's a Tcl profiler available by my one quick attempt to get it to work within the AOLserver/OpenACS 4 environment failed.  Has anyone else  gotten this to work?

Posted by Jonathan Ellis on
Getting nsprofile to work was pretty easy in 3.2.x following the instructions here although I floundered around a LOT before finding that page. No idea as to whether 4.x breaks anything somehow although since I belive it's all AOLServer code it should be okay.
Posted by carl garland on
I have a wimpy point article here that has code that may be helpful.