婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 實現ASP程序執行時間統計類的代碼

實現ASP程序執行時間統計類的代碼

熱門標簽:咸陽銷售外呼系統 外呼回撥系統圖片 常用地圖標注范圍點 蘭州智能語音電銷機器人功能 離線電子地圖標注軟件注冊 寧夏怎么申請400電話 為什么外呼系統需要預存話費呢 企數外呼系統能用多久 辦理400電話一年多少錢
第一次寫ASP類,實現功能:分段統計程序執行時間,輸出統計表等. 
復制代碼 代碼如下:

Class ccClsProcessTimeRecorder 
'程序作者:明月星光 
'作者主頁:http://www.5iya.com/blog 
'http://www.kuozhanming.com 
'ASP程序代碼執行時間統計類 

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

  Private Sub Class_Initialize 
    ccStrInterval = "|"  '默認分隔符 
    ccIntDecimal = 4    '小數點后位數 
    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
輸出時是否帶HTML換行標簽
-html:輸出HTML換行標簽和文本換行符(默認)
-text:僅輸出文本換行符

類方法:
1.Record("Code Name")
統計自上一次調用Record方法至現在的時間(第一次調用時統計聲明類時至調用時時間),最后在Statistic中輸出

類函數:(即時返回信息)
1.Nonce
輸出自上一次調用nonce函數至現在的時間(第一次調用時統計聲明類時至調用時時間)
2.Total
輸出聲明類到現在總時間
3.Statistic
輸出所有Record統計信息和總程序時間

實例代碼:
復制代碼 代碼如下:

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
您可能感興趣的文章:
  • ASP程序代碼執行時間統計類
  • asp.net顯示頁面執行時間
  • asp.net 通過httpModule計算頁面的執行時間
  • asp.net計算每個頁面執行時間的方法
  • ASP顯示頁面執行時間的方法

標簽:鐵嶺 麗江 溫州 家電維修 昆明 昌都 泰州 咸陽

巨人網絡通訊聲明:本文標題《實現ASP程序執行時間統計類的代碼》,本文關鍵詞  實現,ASP,程序,執行,時間,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《實現ASP程序執行時間統計類的代碼》相關的同類信息!
  • 本頁收集關于實現ASP程序執行時間統計類的代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 凉城县| 岳阳市| 修水县| 兴化市| 东港市| 开远市| 莎车县| 通海县| 边坝县| 富锦市| 白朗县| 郴州市| 阿图什市| 应城市| 达日县| 衡水市| 浏阳市| 安龙县| 玉屏| 昌平区| 抚松县| 曲水县| 平江县| 宜宾市| 革吉县| 宜州市| 凌云县| 天长市| 浙江省| 沙河市| 通道| 浦县| 乌拉特前旗| 洛隆县| 怀柔区| 汉中市| 昔阳县| 农安县| 通辽市| 东丰县| 二连浩特市|