The first time I write an ASP class, implement functions: segmented statistics program execution time, output statistics table, etc.
The code copy is as follows:
ClassccClsProcessTimeRecorder
'Program Author: Mingyuexingguang
'Author's homepage: http://www.5iya.com/blog
'http://www.kuozhanming.com
'ASP program code execution time statistics class
PrivateccInti,ccIntNonceTime,ccIntDecimal
PrivateccIntStartTime,ccIntEndTime,ccIntNow,ccIntNonce
PrivateccStrInterval,ccStrEvent,ccStrTime,ccStrStatisticLog,ccStrFormatInterval
PrivateccArrEvent,ccArrTime
PrivateSubClass_Initialize
ccStrInterval="|"'Default Delimiter
ccIntDecimal=4'Number of digits after decimal point
ccStrEvent=""
ccStrTime=""
ccStrFormatInterval="<br/>"&vbCrLf
ccIntStartTime=Timer
ccIntNow=ccIntStartTime
ccIntNonce=ccIntStartTime
EndSub
PublicSubRecord(ccStrEventName)
ccStrEvent=ccStrEvent&ccStrInterval&Replace(ccStrEventName,ccStrInterval,"")
ccStrTime=ccStrTime&ccStrInterval&FormatNumber(Timer-ccIntNow,ccIntDecimal,True,False,True)
ccIntNow=Timer
EndSub
PublicPropertyLetFormat(ccStrFormatType)
IfLCase(Trim(ccStrFormatType))="html"Then
ccStrFormatInterval="<br/>"&vbCrLf
Else
ccStrFormatInterval=vbCrLf
EndIf
EndProperty
PublicFunctionStatistic
IfInStr(ccStrEvent,ccStrInterval)>0Then
ccIntEndTime=Timer
ccArrEvent=Split(ccStrEvent,ccStrInterval)
ccArrTime=Split(ccStrTime,ccStrInterval)
ccStrStatisticLog=ccStrStatisticLog&"ProcessTimeRecord"&ccStrFormatInterval
ccStrStatisticLog=ccStrStatisticLog&"--------------------------------------"&ccStrFormatInterval