国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

實現(xiàn)ASP程序執(zhí)行時間統(tǒng)計類的代碼

2024-05-04 10:58:06
字體:
供稿:網(wǎng)友
第一次寫ASP類,實現(xiàn)功能:分段統(tǒng)計程序執(zhí)行時間,輸出統(tǒng)計表等. 
復(fù)制代碼 代碼如下:

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

  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ù)點后位數(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 
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴业县| 九江市| 德保县| 绥棱县| 黔江区| 武威市| 沧州市| 禄丰县| 博客| 原阳县| 苏尼特左旗| 哈尔滨市| 喜德县| 大冶市| 临武县| 康平县| 朝阳区| 衡山县| 安新县| 鸡西市| 阿拉善左旗| 荥经县| 寿宁县| 平顶山市| 北碚区| 黄石市| 阿克苏市| 陆河县| 苏尼特右旗| 彝良县| 望都县| 兴山县| 微山县| 子长县| 阳朔县| 图片| 抚顺县| 永登县| 米易县| 宁明县| 海晏县|