Chinaunix首页 | 论坛 | 博客
  • 博客访问: 832884
  • 博文数量: 117
  • 博客积分: 2595
  • 博客等级: 少校
  • 技术积分: 1204
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-18 18:16
文章分类

全部博文(117)

文章存档

2013年(1)

2012年(2)

2011年(18)

2010年(95)

2009年(1)

分类: 系统运维

2010-12-27 21:15:26

参考:http://hi.baidu.com/luo2635505/blog/item/019c441186b6d5f0c3ce79ac.html


'##############
'
start 计算页面时间
Class PageTimer
    private startTime,endTime
    Sub startTimer()
        startTime=timer()
    End Sub
    public function delay(s)
        SecCount = 0
        Sec2 = 0
        While SecCount < s + 1
            Sec1 = Second(Time())
            If Sec1 <> Sec2 Then
                Sec2 = Second(Time())
                SecCount = SecCount + 1
            End If
        Wend
    End Function
    Sub showTimer()
        if startTime="" or isempty(startTime) then
            echo    "请先执行    call startTimer() "
            exit sub
        End If
        endTime=timer()
        echo "页面执行时间:"&FormatNumber((endTime-startTime)*1000,3,-1,0,0)&"毫秒"
    End Sub
End Class
'End 计算页面加载时间
'
##############


用的时候就:


'##asp开始放下面代码'
dim asptimer
set asptimer=new PageTimer
asptimer.startTimer()

'xxxx内容'

'或者用这个延迟函数(不要用的太频繁,否则CPU受不了)'
asptimer.delay(1)

'##asp结尾部分'
asptimer.showTimer()


阅读(4978) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-12-30 14:07:29

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com