大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> 如何获得asp页面的载入时间(转)

如何获得asp页面的载入时间(转)

时间: 2021-07-31 作者:daque

怎样赢得asp页面包车型的士载时髦间<!--- how can i time the execution speed of my asp pages to the millisecond? --->doing this is easy with a simple server-side javascript function:<script language=jscript runat=server>function gettime(){ var d = new date(); return d.gettime();}</script>the gettime() method of the date object in jscript returns the number of millisecond since jan 1st, 1970. therefore all you have to do it take a reading immediately before and after the process you are wanting to time. the following is an example, given that the above code it in gettime.asp: dim starttime, endtime starttime = gettime() ' do some stuff here endtime = gettime() response.write "the process took: " & _ cstr(endtime-starttimes) & "ms to execute"if you want to see your process time in a better format, use the formatmilliseconds function (created for the above timing script by www.learnasp.com):function formatmilliseconds(intmilliseconds){ var elapsedsecs = 0 ar elapsedmins = 0 elapsedsecs=math.floor(intmilliseconds/1000); intmilliseconds=intmilliseconds%1000; elapsedmins=math.floor(elapsedsecs/60) elapsedsecs=elapsedsecs%60; elapsedpretty=elapsedmins + " minute"; if(elapsedmins!=1)elapsedpretty=elapsedpretty+"s"; elapsedpretty = elapsedpretty+" " + elapsedsecs+" second"; if(elapsedsecs!=1)elapsedpretty=elapsedpretty+"s"; elapsedpretty = elapsedpretty+ " " +intmilliseconds+" millisecond"; if(intmilliseconds!=1)elapsedpretty=elapsedpretty+"s"; return elapsedpretty;}

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.