rwniceing
asked on
extract and substract between start and end-time for " for loop" in asp
Dear Exerts,
I try to extract the total execution time of the for loop in the following asp code
and since vbscript is not doing well with miilli-second extraction, so I use javascript code
for extracting time in ms from start and ending of for loop.
Now the code is working, it show the Start and End time. But how to
do substraction on start-time - end time ?
I tried put the end-time javascript right after <% %> similar code to the start time javascript code. But it showed the wrong result that is why I put into head tag for end time javascript code.
Any better approach for doing that ?
Please advise
Rwniceing
I try to extract the total execution time of the for loop in the following asp code
and since vbscript is not doing well with miilli-second extraction, so I use javascript code
for extracting time in ms from start and ending of for loop.
Now the code is working, it show the Start and End time. But how to
do substraction on start-time - end time ?
I tried put the end-time javascript right after <% %> similar code to the start time javascript code. But it showed the wrong result that is why I put into head tag for end time javascript code.
Any better approach for doing that ?
Please advise
Rwniceing
<!DOCTYPE html>
<html>
<script language=javascript runat=server>
var myvar = Date.UTC(a.getFullYear(),a.getMonth(),a.getDay(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds());
response.write("Start time in ms: " + myvar );
</script>
<%
Dim i,a,b,c
for i = 1 to 2e6
a=1234+5678+i
b=1234*5678+i
c=1234/2+i
next
response.write("<br/>(i,a,b,c)=" & i & "=" & a & "=" & b & "=" &c & "<br/>")
%>
<body>
</body>
<head runat="server">
<title>Demo Page for Test</title>
<script language="javascript" type="text/javascript" >
var a = new Date();
var myvar = Date.UTC(a.getFullYear(),a.getMonth(),a.getDay(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds());
document.write("End time in ms: ",myvar);
</script>
</head>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Done and thanks for your reply
ASKER
Open in new window
That is why on my topic post code, it will response.write the output after the for loop completion
and the start and end time is also correct but just echo out at the same time that is strange I feel.
Probably it is caused by the setting on response.buffer.