Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Script execution time

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-22 : 09:30:03
hi,
how do i get the time spent for an ASP script to execute ?

afrika

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-06-22 : 09:35:24
ASP, I usually use a wall clock.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-22 : 09:38:38
cant be that slow.

But seriously how do i check ?
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-22 : 09:41:31
e.g this site has a
quote:
SQL Server Forums at SQLTeam.com © (c) SQLTeam.com 2005

This page was generated in 0.17 seconds.

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-06-22 : 09:41:48
OK, a serious answer....

Basically, you take the time at the start of the page, and the time at the end of the page, then measure the difference. Unfortunately, the vbscript date function doesn't have the resolution to count in milliseconds, but we can use some server side jscript.

In an include, I have this function..

<script language="javascript1.2" runat=server>
function milliDif() {
var d = new Date();
return d.getTime()
}
</script>

Then at the top of the page, i do this :

<%
dim tStart, tFinish
tStart = milliDif()

%>


and at the bottom, I do this :

<%
tFinish = milliDif()
response.write "<!-- " & (tFinish - tStart) & " -->"

%>

and it pastes the millisecond difference in an HTML comment.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-22 : 09:46:44
real nice Damian. Gracia mon ami

Only draw back is taht i dont use jscript for server executions. I wonder how i woudl get this done.

But in your opinion do you really think ASP is that slow ?

quote:
ASP, I usually use a wall clock.

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-06-22 : 09:48:28
It's not a draw back, I don't use it either, except for that one function. You can include that little snippet inside a VBScript asp page. Try it.

As for the wall clock thing, it was a joke... laugh



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-22 : 09:55:21
Ok sir

quote:
As for the wall clock thing, it was a joke... laugh

Was beginning to think you were one of the MS haters
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-06-22 : 09:57:30
An MS hater that's spent nearly 5 years moderating an SQL Server site ? That just doesn't make any sense now does it ?



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-22 : 10:06:55
No it doesnt,
but the dialect of MS haters is common.

One of them is with speed (MS being sluggish). That was my reasoning.

thanks for the code still. Am going to test it.
Go to Top of Page
   

- Advertisement -