The Toolkit for Online Communities
18739 Community Members, 0 members online, 1936 visitors today
Log In Register
OpenACS Home : Forums : .LRN Q&A : Computing script execution time

Forum .LRN Q&A: Computing script execution time

Icon of envelope Request notifications


We are trying to compute how much time a dotLRN script takes to execute. After we compute the execution time, we want to store it in a dotlrn table along with the userID, the URL and some other stuff.

We want to collect those statistics in order to derive capacity planning models.

Let me first show you what we did.

In file:


We included this code:

set reloj [clock clicks -milliseconds]
set insertar "insert into tiempo(tiempo_inicio) values($reloj)"
db_dml do_insert $insertar

In file:

# var/lib/aolserver/dotlrn/packages/dotlrn/lib/toolbar.tcl

We included the following code:

set user_id [ad_conn user_id]
set url [ad_conn url]

db_multirow -unclobber -extend {tiempo1} tiempo select_tiempo "select t.tiempo_inicio as tiempo from tiempo t" {
set tiempo1 $tiempo
set tiempo2 [clock clicks -milliseconds]
if {$tiempo2 < 0} {
set postiempo [expr abs($tiempo1)]
set tiempo3 [expr abs($tiempo2)]
set residuo [expr $postiempo-$tiempo3]
set tiempo_comienza [expr abs($tiempo2)]
} else {
set residuo [expr $tiempo2-$tiempo1]
set tiempo_comienza [expr abs($tiempo1)]

set insertar "insert into clinica(usuario,pagina,tinicio,tacceso) values($user_id,\'$url',$tiempo_comienza, $residuo)"
db_dml do_insert $insertar
db_dml _delete "delete from tiempo"

1. Notice that in order for this code to be correct the file blank-master.tcl should be about the first file to be executed and the file toolbar.tcl should be the last. Is this true?

2. Is the code in the second file correct? We have but primitive dotLRN API skills. This simple code was developed by students, but it looks to me rather complicated. Shouldn’t it look more like a simple subtraction of initial time with end time?

3. Notice also that in the first file, the initial time is stored in a separate table, which will slow down the global execution time. Is there a way to communicate the initial time between both files without storing it in a table?

Finally, we introduced in file

The following code:

At the beginning of label "head":

var d= new Date();
var segundos=d.getSeconds();
var tiempo1=d.getMilliseconds();


And near the end:


var d2= new Date();
var tiempo2=d2.getMilliseconds();
var segundos2 =d2.getSeconds();

if (segundos==segundos2)
var resultado=tiempo2-tiempo1;
var resultado=tiempo2-tiempo1;
document.write(" El tiempo de descarga es: "+ resultado+ " ms");

This is not the same time as computed in the previous code. Is there no way to, again, simply communicate the variable between files? Sort of like:

document.write(" El tiempo de descarga es: "+ $residuo+ " ms");

Thanks for your kind help.

Raul R.

Posted by Nima Mazloumi on
no sure whether you need that. Try the request monitor first http://media.wu-wien.ac.at/download/
Posted by Raúl V. Ramírez-Velarde on

Thanks, we'll install it. But does it calculate execution times? Sort of like php-Nuke does. It is actually not that difficult.