最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ASP程序代碼執(zhí)行時(shí)間統(tǒng)計(jì)類

 更新時(shí)間:2006年09月30日 00:00:00   作者:  
第一次寫ASP類,實(shí)現(xiàn)功能:分段統(tǒng)計(jì)程序執(zhí)行時(shí)間,輸出統(tǒng)計(jì)表等.
復(fù)制代碼 代碼如下:

Class ccClsProcessTimeRecorder
'程序作者:明月星光
'作者主頁:http://www.5iya.com/blog
'http://www.kuozhanming.com
'ASP程序代碼執(zhí)行時(shí)間統(tǒng)計(jì)類

  Private ccInti,ccIntNonceTime,ccIntDecimal
  Private ccIntStartTime,ccIntEndTime,ccIntNow,ccIntNonce
  Private ccStrInterval,ccStrEvent,ccStrTime,ccStrStatisticLog,ccStrFormatInterval
  Private ccArrEvent,ccArrTime

  Private Sub Class_Initialize
    ccStrInterval = "|"  '默認(rèn)分隔符
    ccIntDecimal = 4    '小數(shù)點(diǎn)后位數(shù)
    ccStrEvent = ""
    ccStrTime = ""
    ccStrFormatInterval = "<br />" & vbCrLf
    ccIntStartTime = Timer
    ccIntNow = ccIntStartTime
    ccIntNonce = ccIntStartTime
  End Sub

  Public Sub Record(ccStrEventName)
    ccStrEvent = ccStrEvent & ccStrInterval & Replace(ccStrEventName,ccStrInterval,"")
    ccStrTime = ccStrTime & ccStrInterval & FormatNumber(Timer-ccIntNow,ccIntDecimal,True,False,True)
    ccIntNow = Timer
  End Sub

  Public Property Let Format(ccStrFormatType)
    If LCase(Trim(ccStrFormatType)) = "html" Then
      ccStrFormatInterval = "<br />" & vbCrLf
    Else
      ccStrFormatInterval = vbCrLf
    End If
  End Property

  Public Function Statistic
    If InStr(ccStrEvent,ccStrInterval) > 0 Then
      ccIntEndTime = Timer
      ccArrEvent = Split(ccStrEvent,ccStrInterval)
      ccArrTime = Split(ccStrTime,ccStrInterval)
      ccStrStatisticLog = ccStrStatisticLog & "Process Time Record" & ccStrFormatInterval
      ccStrStatisticLog = ccStrStatisticLog & "--------------------------------------" & ccStrFormatInterval
      For ccInti = 1 To UBound(ccArrEvent)
        ccStrStatisticLog = ccStrStatisticLog & ccArrEvent(ccInti) & " : " & ccArrTime(ccInti) & " s" & ccStrFormatInterval
      Next
      ccStrStatisticLog = ccStrStatisticLog & "--------------------------------------" & ccStrFormatInterval
      ccStrStatisticLog = ccStrStatisticLog & "Total : " & FormatNumber(ccIntEndTime-ccIntStartTime,ccIntDecimal,True,False,True) & " s"
      Statistic = ccStrStatisticLog
    Else
      Statistic = "No Record"
    End If
  End Function

  Public Function Nonce
    ccIntNonceTime = FormatNumber(Timer-ccIntNonce,ccIntDecimal,True,False,True)
    ccIntNonce = Timer
    Nonce = ccIntNonceTime
  End Function

  Public Function Total
    Total = FormatNumber(Timer-ccIntStartTime,ccIntDecimal,True,False,True)
  End Function
End Class

類屬性:
1.Format
輸出時(shí)是否帶HTML換行標(biāo)簽
-html:輸出HTML換行標(biāo)簽和文本換行符(默認(rèn))
-text:僅輸出文本換行符

類方法:
1.Record("Code Name")
統(tǒng)計(jì)自上一次調(diào)用Record方法至現(xiàn)在的時(shí)間(第一次調(diào)用時(shí)統(tǒng)計(jì)聲明類時(shí)至調(diào)用時(shí)時(shí)間),最后在Statistic中輸出

類函數(shù):(即時(shí)返回信息)
1.Nonce
輸出自上一次調(diào)用nonce函數(shù)至現(xiàn)在的時(shí)間(第一次調(diào)用時(shí)統(tǒng)計(jì)聲明類時(shí)至調(diào)用時(shí)時(shí)間)
2.Total
輸出聲明類到現(xiàn)在總時(shí)間
3.Statistic
輸出所有Record統(tǒng)計(jì)信息和總程序時(shí)間
復(fù)制代碼 代碼如下:

Dim objRecord,i,k,j,x
Set objRecord = New ccClsProcessTimeRecorder
objRecord.Format = "html"
For i = 1 To 100000
  x = 2 + 2
Next
Call objRecord.Record("加法")
For j = 1 To 100000
  x = 2 * 2
Next
Call objRecord.Record("乘法")
For k = 1 To 100000
  x = 2 ^ 2
Next
Call objRecord.Record("開方")
Response.Write objRecord.Statistic

輸出:
Process Time Record
--------------------------------------
加法 : 0.0625 s
乘法 : 0.0469 s
開方 : 0.1094 s
--------------------------------------
Total : 0.2188 s

相關(guān)文章

  • 創(chuàng)建一個(gè)ASP通用分頁類

    創(chuàng)建一個(gè)ASP通用分頁類

    創(chuàng)建一個(gè)ASP通用分頁類...
    2006-07-07
  • Object對(duì)象的一些的隱藏函數(shù)介紹

    Object對(duì)象的一些的隱藏函數(shù)介紹

    Object對(duì)象的一些的隱藏函數(shù)介紹...
    2006-08-08
  • ASP高亮類

    ASP高亮類

    ASP高亮類...
    2006-08-08
  • EasyASP v1.5發(fā)布(包含數(shù)據(jù)庫操作類,原clsDbCtrl.asp)

    EasyASP v1.5發(fā)布(包含數(shù)據(jù)庫操作類,原clsDbCtrl.asp)

    EasyASP是一個(gè)方便快速開發(fā)ASP的類,其中包含了一個(gè)數(shù)據(jù)庫控制類(原clsDbCtrl.asp,對(duì)原代碼作了優(yōu)化和修改,包含對(duì)數(shù)據(jù)庫的各類操作及存儲(chǔ)過程的調(diào)用,全部封裝在Easp.db中,使用起來會(huì)更方便,調(diào)用也更簡單)。
    2008-10-10
  • 分頁類,異常類

    分頁類,異常類

    分頁類,異常類...
    2006-07-07
  • 最新評(píng)論

    双流县| 淮阳县| 青州市| 新竹县| 瓮安县| 余姚市| 余姚市| 平遥县| 泸西县| 阜宁县| 靖边县| 云阳县| 伊通| 乐亭县| 钟山县| 绥芬河市| 八宿县| 巴彦淖尔市| 巴中市| 深州市| 张家港市| 浏阳市| 惠东县| 隆昌县| 益阳市| 钟祥市| 吉林省| 吴堡县| 岗巴县| 陕西省| 资阳市| 友谊县| 肥西县| 和平区| 谷城县| 正定县| 永泰县| 军事| 望城县| 辽宁省| 宁德市|