Forum Moderators: open
I'm trying to find out how long my script executes in asp.net (VB script).
I use this code on the top of the page:
StartTime = Timer
...and use this at the bottom of the page:
EndTime = Timer
The problem is that both of those numbers are exactly the same:
Something like "59297.15625", so I can't figure out how much time the webpage took to execute...
The numbers change when I refresh the page, but within the page all Timer values are the same.
Is it cached or something? How could I fix it?
Thanks,
NB
In your Page directive, just add trace="True" and you will see at the bottom of your page, all the load times, your control tree sizes etc.
raywood, your solution looked so right... I was almost sure it would work, but for some reason it didn't.
Here is an example of what I got:
StartTime: 8:11:13 PM
---------- Some code that executes for a while...
EndTime: 8:11:13 PM
ElapsedTime: 00:00:00
No matter what, I always get an elapsed time of
"00:00:00".
I'm not sure what I'm doing wrong - maybe the time is cached on the server (while the same page executes).
Try displaying the .Ticks property of the time instead of formatting the time.
To use the Trace function (mentioned above), either 1) add the Trace="true" to the <%@Page> directive at the top of the aspx file (in HTML view) or 2) Add it to all pages on the site. Modify the web.config file and change the <trace enabled="false"> element to true. The use the virtual url [example.com...] where example.com is your domain name. You will then be able to look at the trace info for all recently visited pages.