improve timer usage in parsing engine for more accurate report

git-svn-id: svn://10.0.0.236/trunk@48839 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com
1999-09-22 07:41:53 +00:00
parent 80e6d0e226
commit b5bb9a48c0
4 changed files with 42 additions and 44 deletions

View File

@@ -613,6 +613,10 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
}
}
STOP_TIMER();
#ifdef RICKG_DEBUG
//let's only grab this state once!
if(!gShowCRC) {
gShowCRC=1; //this only indicates we'll not initialize again.
@@ -624,8 +628,6 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
}
}
STOP_TIMER();
if(2==gShowCRC) {
if(mComputedCRC32!=mExpectedCRC32) {
if(mExpectedCRC32!=0) {
@@ -640,6 +642,9 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
else result = aSink->DidBuildModel(0);
}
else result=aSink->DidBuildModel(0);
#else
result=aSink->DidBuildModel(0);
#endif
if(mDTDDebug) {
mDTDDebug->DumpVectorRecord();
@@ -1103,7 +1108,10 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
result=CollectSkippedContent(aNode,theAttrCount);
}
STOP_TIMER();
if(mParser) {
nsAutoString charsetValue;
nsCharsetSource charsetSource;
CObserverService& theService=mParser->GetObserverService();
@@ -1115,8 +1123,14 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
charsetValue,charsetSource);
}
START_TIMER();
if(NS_SUCCEEDED(result)) {
#ifdef RICKG_DEBUG
STOP_TIMER();
if(eHTMLTag_meta==aTag) {
PRInt32 theCount=aNode.GetAttributeCount();
if(1<theCount){
@@ -1137,6 +1151,11 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
} //if
}//if
START_TIMER();
#endif
if(NS_OK==result) {
result=gHTMLElements[aTag].HasSpecialProperty(kDiscardTag) ? 1 : NS_OK;
}

View File

@@ -196,7 +196,6 @@ nsParser::nsParser(nsITokenObserver* anObserver) : mCommand(""), mUnusedInput(""
mInternalState=NS_OK;
#ifdef RAPTOR_PERF_METRICS
mParseTime.Reset();
#endif
}
@@ -1316,25 +1315,6 @@ nsresult nsParser::OnDataAvailable(nsIURI* aURL, nsIInputStream *pIStream, PRUin
if(mParserFilter)
mParserFilter->RawBuffer(mParserContext->mTransferBuffer, &theNumRead);
#if 0
// The following Hack have moved to nsScanner.cpp
// Remove that Hack if you feel this hack is not necessary
// XXX Hack --- NULL character(s) is(are) seen in the middle of the buffer!!!
// For now, I'm conditioning the raw buffer by removing the unwanted null chars.
// Problem could be NECKO related
for(PRUint32 i=0;i<theNumRead;i++) {
if(mParserContext->mTransferBuffer[i]==kNullCh)
mParserContext->mTransferBuffer[i]=kSpace;
}
#endif
#ifdef NS_DEBUG
int index=0;
for(index=0;index<10;index++)
mParserContext->mTransferBuffer[theNumRead+index]=0;
#endif
mParserContext->mScanner->Append(mParserContext->mTransferBuffer,theNumRead);
#ifdef rickgdebug