diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -4514,6 +4514,8 @@ PRBool isSafeToFlush; IsSafeToFlush(isSafeToFlush); + PRTime start = PR_Now(); + fprintf(stdout, "{"); NS_ASSERTION(!isSafeToFlush || mViewManager, "Must have view manager"); // Make sure the view manager stays alive while batching view updates. nsCOMPtr viewManagerDeathGrip = mViewManager; @@ -4583,6 +4585,7 @@ batch.EndUpdateViewBatch(updateFlags); } + fprintf(stdout, "}%d", (unsigned int)(PR_Now() - start)/1000); return NS_OK; } diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -1724,10 +1724,15 @@ PRBool isFinalChunk = mParserContext && mParserContext->mStreamListenerState == eOnStop; + PRTime start = PR_Now(); + fprintf(stdout, "["); + if (mSink) { mSink->WillParse(); } result = ResumeParse(PR_TRUE, isFinalChunk); // Ref. bug 57999 + fprintf(stdout, "]%d", (unsigned int)(PR_Now() - start) / 1000); + if (result != NS_OK) { result=mInternalState; @@ -2184,6 +2189,7 @@ PRBool aCanInterrupt) { nsresult result = NS_OK; + printf("\n"); if ((mFlags & NS_PARSER_FLAG_PARSER_ENABLED) && mInternalState != NS_ERROR_HTMLPARSER_STOPPARSING) { @@ -2193,18 +2199,24 @@ NS_ASSERTION(!mSpeculativeScriptThread || !mSpeculativeScriptThread->Parsing(), "Bad races happening, expect to crash!"); + PRTime start = PR_Now(); + printf("1-"); CParserContext *originalContext = mParserContext; result = WillBuildModel(mParserContext->mScanner->GetFilename()); if (NS_FAILED(result)) { mFlags &= ~NS_PARSER_FLAG_CAN_TOKENIZE; return result; } + printf("-1(%d)", (unsigned int)(PR_Now() - start) / 1000); if (mParserContext->mDTD) { mParserContext->mDTD->WillResumeParse(mSink); PRBool theIterationIsOk = PR_TRUE; while (result == NS_OK && theIterationIsOk) { + start = PR_Now(); + printf("2-"); + if (!mUnusedInput.IsEmpty() && mParserContext->mScanner) { // -- Ref: Bug# 22485 -- // Insert the unused input into the source buffer @@ -2220,8 +2232,16 @@ nsresult theTokenizerResult = (mFlags & NS_PARSER_FLAG_CAN_TOKENIZE) ? Tokenize(aIsFinalChunk) : NS_OK; + printf("-2(%d)", (unsigned int)(PR_Now() - start) / 1000); + + start = PR_Now(); + printf("3-"); result = BuildModel(); + printf("-3(%d)", (unsigned int)(PR_Now() - start) / 1000); + + start = PR_Now(); + printf("4-"); if (result == NS_ERROR_HTMLPARSER_INTERRUPTED && aIsFinalChunk) { PostContinueEvent(); } @@ -2253,15 +2273,24 @@ } return NS_OK; } + printf("-4(%d)", (unsigned int)(PR_Now() - start) / 1000); + + start = PR_Now(); + printf("5-"); if (NS_ERROR_HTMLPARSER_STOPPARSING == result) { // Note: Parser Terminate() calls DidBuildModel. if (mInternalState != NS_ERROR_HTMLPARSER_STOPPARSING) { DidBuildModel(mStreamStatus); mInternalState = result; } + printf("-5e(%d)", (unsigned int)(PR_Now() - start) / 1000); return NS_OK; } + printf("-5(%d)", (unsigned int)(PR_Now() - start) / 1000); + + start = PR_Now(); + printf("6-"); if ((NS_OK == result && theTokenizerResult == kEOF) || result == NS_ERROR_HTMLPARSER_INTERRUPTED) { PRBool theContextIsStringBased = @@ -2273,18 +2302,7 @@ if (mParserContext->mStreamListenerState == eOnStop) { DidBuildModel(mStreamStatus); - MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this)); - MOZ_TIMER_STOP(mParseTime); - - MOZ_TIMER_LOG(("Parse Time (this=%p): ", this)); - MOZ_TIMER_PRINT(mParseTime); - - MOZ_TIMER_LOG(("DTD Time: ")); - MOZ_TIMER_PRINT(mDTDTime); - - MOZ_TIMER_LOG(("Tokenize Time: ")); - MOZ_TIMER_PRINT(mTokenizeTime); - + printf("-6e(%d)", (unsigned int)(PR_Now() - start) / 1000); return NS_OK; } } else { @@ -2305,6 +2323,7 @@ } } } + printf("-6(%d)", (unsigned int)(PR_Now() - start) / 1000); if (theTokenizerResult == kEOF || result == NS_ERROR_HTMLPARSER_INTERRUPTED) { @@ -2322,6 +2341,7 @@ MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this)); MOZ_TIMER_STOP(mParseTime); + printf("\n"); return (result == NS_ERROR_HTMLPARSER_INTERRUPTED) ? NS_OK : result; } @@ -2332,6 +2352,8 @@ nsresult nsParser::BuildModel() { + PRTime start = PR_Now(); + fprintf(stdout, "/"); CParserContext* theRootContext = mParserContext; nsITokenizer* theTokenizer = nsnull; @@ -2357,6 +2379,7 @@ } else { mInternalState = result = NS_ERROR_HTMLPARSER_BADTOKENIZER; } + fprintf(stdout, "\\%d", (unsigned int)(PR_Now() - start)/1000); return result; } @@ -2869,12 +2892,17 @@ // Don't bother to start parsing until we've seen some // non-whitespace data + PRTime start = PR_Now(); + fprintf(stdout, "["); + if (theContext->mScanner->FirstNonWhitespacePosition() >= 0) { if (mSink) { mSink->WillParse(); } rv = ResumeParse(); } + fprintf(stdout, "]%d", (unsigned int)(PR_Now() - start) / 1000); + } else { rv = NS_ERROR_UNEXPECTED; } @@ -2921,10 +2949,14 @@ mParserFilter->Finish(); if (NS_SUCCEEDED(rv)) { + PRTime start = PR_Now(); + fprintf(stdout, "["); + if (mSink) { mSink->WillParse(); } rv = ResumeParse(PR_TRUE, PR_TRUE); + fprintf(stdout, "]%d", (unsigned int)(PR_Now() - start) / 1000); } // If the parser isn't enabled, we don't finish parsing till diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -506,9 +506,27 @@ if (event) { LOG(("THRD(%p) running [%p]\n", this, event.get())); + + PRBool isMainThread = NS_IsMainThread(); + if (isMainThread) + printf ("$"); + + PRIntervalTime t0 = PR_IntervalNow(); + ++mRunningEvent; event->Run(); --mRunningEvent; + + PRIntervalTime t1 = PR_IntervalNow(); + + PRUint32 td = PR_IntervalToMilliseconds(t1 - t0); + if (isMainThread) { + if (td > 100) { + printf ("-E(0x%08x,%d)", (unsigned int) (void*) event.get(), td); + } + printf ("&"); + } + } else if (mayWait) { NS_ASSERTION(ShuttingDown(), "This should only happen when shutting down"); rv = NS_ERROR_UNEXPECTED;