a=sdagley. Move over to new timing macros...

This commit is contained in:
nisheeth%netscape.com 1999-11-10 03:41:09 +00:00
Родитель a1c18a8cc0
Коммит 6a7c8adf6c
21 изменённых файлов: 667 добавлений и 758 удалений

Просмотреть файл

@ -34,7 +34,7 @@
#include "nsIDocument.h"
#include "nsIStyleFrameConstruction.h"
#include "nsLayoutAtoms.h"
#include "stopwatch.h"
#include "nsTimer.h"
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
#endif
@ -200,9 +200,7 @@ protected:
nsIStyleFrameConstruction* mFrameConstructor;
#ifdef MOZ_PERF_METRICS
Stopwatch mStyleResolutionWatch;
#endif
MOZ_TIMER_DECLARE(mStyleResolutionWatch);
};
StyleSetImpl::StyleSetImpl()
@ -621,8 +619,8 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aContent, "must have content");
@ -665,8 +663,8 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -711,8 +709,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
@ -757,8 +755,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -768,8 +766,8 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
@ -813,8 +811,8 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -1107,7 +1105,7 @@ StyleSetImpl::ResetTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Reset();
MOZ_TIMER_RESET(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1121,7 +1119,7 @@ StyleSetImpl::StartTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Start();
MOZ_TIMER_START(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1135,7 +1133,7 @@ StyleSetImpl::StopTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Stop();
MOZ_TIMER_STOP(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1149,7 +1147,7 @@ StyleSetImpl::PrintTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Print();
MOZ_TIMER_PRINT(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;

Просмотреть файл

@ -80,7 +80,7 @@
#include "nsIStyleSheetLinkingElement.h"
#include "nsIDOMHTMLTitleElement.h"
#include "stopwatch.h"
#include "nsTimer.h"
#include "nsDOMError.h"
static NS_DEFINE_IID(kIDOMHTMLTitleElementIID, NS_IDOMHTMLTITLEELEMENT_IID);
@ -285,9 +285,7 @@ public:
void ForceReflow();
#endif
#ifdef MOZ_PERF_METRICS
Stopwatch mWatch; // Measures content model creation time for current document
#endif
MOZ_TIMER_DECLARE(mWatch); // Measures content model creation time for current document
};
class SinkContext {
@ -1918,15 +1916,16 @@ HTMLContentSink::Init(nsIDocument* aDoc,
nsIURI* aURL,
nsIWebShell* aContainer)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: nsHTMLContentSink::Init(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Reset and start: nsHTMLContentSink::Init(), this=%p\n", this));
MOZ_TIMER_RESET(mWatch);
MOZ_TIMER_START(mWatch);
NS_PRECONDITION(nsnull != aDoc, "null ptr");
NS_PRECONDITION(nsnull != aURL, "null ptr");
NS_PRECONDITION(nsnull != aContainer, "null ptr");
if ((nsnull == aDoc) || (nsnull == aURL) || (nsnull == aContainer)) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_NULL_POINTER;
}
@ -1953,8 +1952,8 @@ HTMLContentSink::Init(nsIDocument* aDoc,
// Make root part
nsresult rv = NS_NewHTMLHtmlElement(&mRoot, nsHTMLAtoms::html);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
mRoot->SetDocument(mDocument, PR_FALSE);
@ -1963,15 +1962,15 @@ HTMLContentSink::Init(nsIDocument* aDoc,
// Make head part
nsIAtom* atom = NS_NewAtom("head");
if (nsnull == atom) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_OUT_OF_MEMORY;
}
rv = NS_NewHTMLHeadElement(&mHead, atom);
NS_RELEASE(atom);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
mRoot->AppendChildTo(mHead, PR_FALSE);
@ -1987,8 +1986,8 @@ HTMLContentSink::Init(nsIDocument* aDoc,
this, spec));
nsCRT::free(spec);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2005,11 +2004,10 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
{
// NRA Dump stopwatch stop info here
#ifdef MOZ_PERF_METRICS
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::DidBuildModel(), this=%p\n", this));
NS_STOP_STOPWATCH(mWatch)
RAPTOR_STOPWATCH_TRACE(("Content creation time (this=%p): ", this));
mWatch.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::DidBuildModel(), this=%p\n", this));
MOZ_TIMER_STOP(mWatch);
MOZ_TIMER_LOG(("Content creation time (this=%p): ", this));
MOZ_TIMER_PRINT(mWatch);
#endif
if (nsnull == mTitle) {
@ -2074,15 +2072,15 @@ HTMLContentSink::SetParser(nsIParser* aParser)
NS_IMETHODIMP
HTMLContentSink::BeginContext(PRInt32 aPosition)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::BeginContext()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::BeginContext()\n"));
MOZ_TIMER_START(mWatch);
NS_PRECONDITION(aPosition > -1, "out of bounds");
// Create new context
SinkContext* sc = new SinkContext(this);
if (nsnull == sc) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::BeginContext()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::BeginContext()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2110,16 +2108,16 @@ HTMLContentSink::BeginContext(PRInt32 aPosition)
mContextStack.AppendElement(mCurrentContext);
mCurrentContext = sc;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::BeginContext()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::BeginContext()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::EndContext(PRInt32 aPosition)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::EndContext()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::EndContext()\n"));
MOZ_TIMER_START(mWatch);
NS_PRECONDITION(mCurrentContext != nsnull && aPosition > -1, "non-existing context");
PRInt32 n = mContextStack.Count() - 1;
@ -2147,8 +2145,8 @@ HTMLContentSink::EndContext(PRInt32 aPosition)
mCurrentContext = sc;
mContextStack.RemoveElementAt(n);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::EndContext()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::EndContext()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2156,8 +2154,8 @@ HTMLContentSink::EndContext(PRInt32 aPosition)
NS_IMETHODIMP
HTMLContentSink::SetTitle(const nsString& aValue)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::SetTitle()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::SetTitle()\n"));
MOZ_TIMER_START(mWatch);
NS_ASSERTION(mCurrentContext == mHeadContext, "SetTitle not in head");
if (nsnull == mTitle) {
@ -2167,8 +2165,8 @@ HTMLContentSink::SetTitle(const nsString& aValue)
// If the title was already set then don't try to overwrite it
// when a new title is encountered - For backwards compatiblity
//*mTitle = aValue;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::SetTitle()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::SetTitle()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
ReduceEntities(*mTitle);
@ -2196,8 +2194,8 @@ HTMLContentSink::SetTitle(const nsString& aValue)
NS_RELEASE(it);
}
NS_RELEASE(atom);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::SetTitle()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::SetTitle()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2205,19 +2203,19 @@ NS_IMETHODIMP
HTMLContentSink::OpenHTML(const nsIParserNode& aNode)
{
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenHTML", aNode, 0, this);
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::CloseHTML(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseHTML()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseHTML()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseHTML", aNode, 0, this);
if (nsnull != mHeadContext) {
@ -2225,31 +2223,31 @@ HTMLContentSink::CloseHTML(const nsIParserNode& aNode)
delete mHeadContext;
mHeadContext = nsnull;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseHTML()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseHTML()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::OpenHead(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenHead()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenHead", aNode, 0, this);
nsresult rv = NS_OK;
if (nsnull == mHeadContext) {
mHeadContext = new SinkContext(this);
if (nsnull == mHeadContext) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_OUT_OF_MEMORY;
}
mHeadContext->SetPreAppend(PR_TRUE);
rv = mHeadContext->Begin(eHTMLTag_head, mHead, 0, -1);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
}
@ -2262,32 +2260,32 @@ HTMLContentSink::OpenHead(const nsIParserNode& aNode)
NS_IF_RELEASE(sco);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseHead(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseHead()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseHead()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseHead", aNode,
0, this);
PRInt32 n = mContextStack.Count() - 1;
mCurrentContext = (SinkContext*) mContextStack.ElementAt(n);
mContextStack.RemoveElementAt(n);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseHead()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::OpenBody(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenBody()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_START(mWatch);
//NS_PRECONDITION(nsnull == mBody, "parser called OpenBody twice");
SINK_TRACE_NODE(SINK_TRACE_CALLS,
@ -2298,8 +2296,8 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode)
nsIScriptContextOwner* sco = mDocument->GetScriptContextOwner();
AddAttributes(aNode,mBody,sco,PR_TRUE);
NS_IF_RELEASE(sco);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2309,15 +2307,15 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode)
nsresult rv = mCurrentContext->OpenContainer(aNode);
mCurrentContext->SetPreAppend(PR_FALSE);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
mBody = mCurrentContext->mStack[mCurrentContext->mStackPos - 1].mContent;
NS_ADDREF(mBody);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_STOP(mWatch);
StartLayout();
return NS_OK;
}
@ -2325,8 +2323,8 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode)
NS_IMETHODIMP
HTMLContentSink::CloseBody(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseBody()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseBody()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseBody", aNode,
mCurrentContext->mStackPos-1, this);
@ -2334,8 +2332,8 @@ HTMLContentSink::CloseBody(const nsIParserNode& aNode)
PRBool didFlush;
nsresult rv = mCurrentContext->FlushTextAndRelease(&didFlush);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseBody()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
// Flush out anything that's left
@ -2344,16 +2342,16 @@ HTMLContentSink::CloseBody(const nsIParserNode& aNode)
mCurrentContext->FlushTags();
mCurrentContext->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseBody()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::OpenForm(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenForm()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenForm()\n"));
MOZ_TIMER_START(mWatch);
nsresult result = NS_OK;
nsIHTMLContent* content = nsnull;
@ -2406,8 +2404,8 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode)
mHTMLDocument->AddForm(mCurrentForm);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenForm()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenForm()\n"));
MOZ_TIMER_STOP(mWatch);
return result;
}
@ -2416,8 +2414,8 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode)
NS_IMETHODIMP
HTMLContentSink::CloseForm(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseForm()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseForm()\n"));
MOZ_TIMER_START(mWatch);
nsresult result = NS_OK;
mCurrentContext->FlushTextAndRelease();
@ -2437,16 +2435,16 @@ HTMLContentSink::CloseForm(const nsIParserNode& aNode)
NS_RELEASE(mCurrentForm);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseForm()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseForm()\n"));
MOZ_TIMER_STOP(mWatch);
return result;
}
NS_IMETHODIMP
HTMLContentSink::OpenFrameset(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenFrameset()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenFrameset()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenFrameset", aNode,
mCurrentContext->mStackPos, this);
@ -2456,16 +2454,16 @@ HTMLContentSink::OpenFrameset(const nsIParserNode& aNode)
mFrameset = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;
NS_ADDREF(mFrameset);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenFrameset()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenFrameset()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseFrameset()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseFrameset()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseFrameset", aNode,
mCurrentContext->mStackPos-1, this);
@ -2474,8 +2472,8 @@ HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
nsIHTMLContent* fs = sc->mStack[sc->mStackPos-1].mContent;
PRBool done = fs == mFrameset;
nsresult rv = sc->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseFrameset()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseFrameset()\n"));
MOZ_TIMER_STOP(mWatch);
if (done) {
StartLayout();
}
@ -2485,8 +2483,8 @@ HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
NS_IMETHODIMP
HTMLContentSink::OpenMap(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenMap()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenMap()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenMap", aNode,
@ -2496,16 +2494,16 @@ HTMLContentSink::OpenMap(const nsIParserNode& aNode)
// HTML 4.0 says that MAP elements can have block content
// as children.
rv = mCurrentContext->OpenContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenMap()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenMap()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseMap(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseMap()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseMap()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseMap", aNode,
@ -2513,52 +2511,52 @@ HTMLContentSink::CloseMap(const nsIParserNode& aNode)
NS_IF_RELEASE(mCurrentMap);
rv = mCurrentContext->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseMap()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseMap()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::OpenContainer(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenContainer()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
// XXX work around parser bug
if (eHTMLTag_frameset == aNode.GetNodeType()) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return OpenFrameset(aNode);
}
rv = mCurrentContext->OpenContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseContainer(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseContainer()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseContainer()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
// XXX work around parser bug
if (eHTMLTag_frameset == aNode.GetNodeType()) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return CloseFrameset(aNode);
}
rv = mCurrentContext->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::AddLeaf()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddLeaf()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv;
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
@ -2597,8 +2595,8 @@ HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
break;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::AddLeaf()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::AddLeaf()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
@ -2609,12 +2607,12 @@ HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
* @return error code
*/
nsresult HTMLContentSink::AddComment(const nsIParserNode& aNode) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::AddComment()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddComment()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
rv = mCurrentContext->AddComment(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::AddComment()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::AddComment()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
@ -2626,10 +2624,10 @@ nsresult HTMLContentSink::AddComment(const nsIParserNode& aNode) {
*/
nsresult HTMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode) {
nsresult result= NS_OK;
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_START(mWatch);
// Implementation of AddProcessingInstruction() should start here
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_STOP(mWatch);
return result;
}
@ -2642,13 +2640,13 @@ NS_IMETHODIMP
HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
{
nsresult rv = NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::AddDocTypeDecl()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddDocTypeDecl()\n"));
MOZ_TIMER_START(mWatch);
rv=mHTMLDocument->AddDocTypeDecl(aNode.GetText(),(nsDTDMode)aMode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::AddDocTypeDecl()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::AddDocTypeDecl()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
@ -3469,12 +3467,12 @@ HTMLContentSink::ForceReflow()
void
HTMLContentSink::NotifyAppend(nsIContent* aContainer, PRInt32 aStartIndex)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Save and stop: nsHTMLContentSink::NotifyAppend()\n"));
NS_SAVE_STOPWATCH_STATE(mWatch)
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Save and stop: nsHTMLContentSink::NotifyAppend()\n"));
MOZ_TIMER_SAVE(mWatch)
MOZ_TIMER_STOP(mWatch);
mDocument->ContentAppended(aContainer, aStartIndex);
RAPTOR_STOPWATCH_DEBUGTRACE(("Restore: nsHTMLContentSink::NotifyAppend()\n"));
NS_RESTORE_STOPWATCH_STATE(mWatch)
MOZ_TIMER_DEBUGLOG(("Restore: nsHTMLContentSink::NotifyAppend()\n"));
MOZ_TIMER_RESTORE(mWatch);
}
void
@ -3482,12 +3480,12 @@ HTMLContentSink::NotifyInsert(nsIContent* aContent,
nsIContent* aChildContent,
PRInt32 aIndexInContainer)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Save and stop: nsHTMLContentSink::NotifyInsert()\n"));
NS_SAVE_STOPWATCH_STATE(mWatch)
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Save and stop: nsHTMLContentSink::NotifyInsert()\n"));
MOZ_TIMER_SAVE(mWatch)
MOZ_TIMER_STOP(mWatch);
mDocument->ContentInserted(aContent, aChildContent, aIndexInContainer);
RAPTOR_STOPWATCH_DEBUGTRACE(("Restore: nsHTMLContentSink::NotifyInsert()\n"));
NS_RESTORE_STOPWATCH_STATE(mWatch)
MOZ_TIMER_DEBUGLOG(("Restore: nsHTMLContentSink::NotifyInsert()\n"));
MOZ_TIMER_RESTORE(mWatch);
}
void
@ -3754,8 +3752,8 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
// Don't include script loading and evaluation in the stopwatch
// that is measuring content creation time
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::ProcessSCRIPTTag()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::ProcessSCRIPTTag()\n"));
MOZ_TIMER_STOP(mWatch);
// Don't process scripts that aren't JavaScript and don't process
// scripts that are inside iframes

Просмотреть файл

@ -69,7 +69,7 @@
#include "nsIDOMHTMLDocument.h"
#include "nsLayoutCID.h"
#include "nsIDOMRange.h"
#include "stopwatch.h"
#include "nsTimer.h"
#include "nsILocaleService.h"
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
@ -492,9 +492,7 @@ protected:
// if there is no mWindow, this will keep track of the bounds --dwc0001
nsRect mBounds;
#ifdef MOZ_PERF_METRICS
Stopwatch mTotalTime;
#endif
MOZ_TIMER_DECLARE(mTotalTime);
#ifdef DETECT_WEBSHELL_LEAKS
private:
@ -2075,13 +2073,14 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
nsresult rv = NS_OK;
rv = aUri->GetSpec(&url);
if (NS_SUCCEEDED(rv)) {
RAPTOR_STOPWATCH_TRACE(("*** Timing layout processes on url: '%s', webshell: %p\n", url, this));
MOZ_TIMER_LOG(("*** Timing layout processes on url: '%s', webshell: %p\n", url, this));
delete [] url;
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: nsWebShell::DoLoadURL(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mTotalTime)
MOZ_TIMER_DEBUGLOG(("Reset and start: nsWebShell::DoLoadURL(), this=%p\n", this));
MOZ_TIMER_RESET(mTotalTime);
MOZ_TIMER_START(mTotalTime);
#endif
/* WebShell was primarily passing the buck when it came to streamObserver.
@ -3320,11 +3319,10 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIDocumentLoaderObserver * aWebShell)
{
#ifdef MOZ_PERF_METRICS
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsWebShell::OnEndDocumentLoad(), this=%p\n", this));
NS_STOP_STOPWATCH(mTotalTime)
RAPTOR_STOPWATCH_TRACE(("Total (Layout + Page Load) Time (webshell=%p): ", this));
mTotalTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: nsWebShell::OnEndDocumentLoad(), this=%p\n", this));
MOZ_TIMER_STOP(mTotalTime);
MOZ_TIMER_LOG(("Total (Layout + Page Load) Time (webshell=%p): ", this));
MOZ_TIMER_PRINT(mTotalTime);
#endif
nsresult rv = NS_ERROR_FAILURE;

Просмотреть файл

@ -42,7 +42,6 @@
#include "nsViewSourceHTML.h"
#include "nsParserNode.h"
#include "nsHTMLEntities.h"
#include "stopwatch.h"
#ifdef XP_PC
#include <direct.h> //this is here for debug reasons...
@ -87,12 +86,12 @@ static eHTMLTags gWhitespaceTags[]={
#ifdef MOZ_PERF_METRICS
# define START_TIMER() \
if(mParser) mParser->mParseTime.Start(PR_FALSE); \
if(mParser) mParser->mDTDTime.Start(PR_FALSE);
if(mParser) MOZ_TIMER_START(mParser->mParseTime); \
if(mParser) MOZ_TIMER_START(mParser->mDTDTime);
# define STOP_TIMER() \
if(mParser) mParser->mParseTime.Stop(); \
if(mParser) mParser->mDTDTime.Stop();
if(mParser) MOZ_TIMER_STOP(mParser->mParseTime); \
if(mParser) MOZ_TIMER_STOP(mParser->mDTDTime);
#else
# define STOP_TIMER()
@ -413,7 +412,7 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
mParseMode=aParseMode;
if((aNotifySink) && (aSink)) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
STOP_TIMER();
if(aSink && (!mSink)) {
@ -421,7 +420,7 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
}
result = aSink->WillBuildModel();
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
START_TIMER();
nsAutoString theTagName("html");
@ -510,7 +509,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
}
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
STOP_TIMER();
#ifdef RICKG_DEBUG
@ -544,7 +543,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
result=aSink->DidBuildModel(0);
#endif
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
START_TIMER();
if(mDTDDebug) {
@ -757,13 +756,13 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
case eHTMLTag_xmp:
//grab the skipped content and dump it out as text...
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
STOP_TIMER()
const nsString& theText=aNode.GetSkippedContent();
if(0<theText.Length()) {
CViewSourceHTML::WriteText(theText,*mSink,PR_TRUE,PR_FALSE);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
START_TIMER()
}
break;
@ -1029,7 +1028,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
result=CollectSkippedContent(aNode,theAttrCount);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
STOP_TIMER()
if(mParser) {
@ -1045,7 +1044,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
charsetValue,charsetSource);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
START_TIMER()
if(NS_SUCCEEDED(result)) {
@ -1257,13 +1256,13 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
case eHTMLTag_area:
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
STOP_TIMER();
if (mHasOpenMap && mSink)
result=mSink->AddLeaf(*theNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
START_TIMER();
break;
@ -1529,13 +1528,13 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
PRInt32 theBadTokenCount = mBodyContext->TokenCountAt(theBadContentIndex);
if(theBadTokenCount > 0) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
STOP_TIMER()
// Pause the main context and switch to the new context.
eHTMLTags theParentTag=mBodyContext->TagAt(theBadContentIndex);
mSink->BeginContext(theBadContentIndex);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
START_TIMER()
nsDTDContext temp;
@ -1580,11 +1579,11 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
for(PRInt32 k=0; k<(theTagCount - theTopIndex); k++)
mBodyContext->Push(temp.Pop());
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
STOP_TIMER()
// Terminate the new context and switch back to the main context
mSink->EndContext(theBadContentIndex);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
START_TIMER()
}
return result;
@ -1642,12 +1641,12 @@ nsresult CNavDTD::HandleCommentToken(CToken* aToken) {
WriteTokenToLog(aToken);
#endif
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->AddComment(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
START_TIMER();
return result;
@ -1719,12 +1718,12 @@ nsresult CNavDTD::HandleProcessingInstructionToken(CToken* aToken){
WriteTokenToLog(aToken);
#endif
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->AddProcessingInstruction(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
START_TIMER();
return result;
@ -1752,12 +1751,12 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){
docTypeStr.Trim("<!>");
nsCParserNode theNode((CHTMLToken*)aToken,mLineNumber,mTokenizer->GetTokenRecycler());
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
STOP_TIMER();
result = (mSink)? mSink->AddDocTypeDecl(theNode,mParseMode):NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
START_TIMER();
return result;
@ -2268,12 +2267,12 @@ nsresult CNavDTD::CloseTransientStyles(eHTMLTags aChildTag){
nsresult CNavDTD::OpenHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenHTML(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
START_TIMER();
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
@ -2292,12 +2291,12 @@ nsresult CNavDTD::OpenHTML(const nsIParserNode& aNode){
nsresult CNavDTD::CloseHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() > 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->CloseHTML(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2317,14 +2316,14 @@ nsresult CNavDTD::OpenHead(const nsIParserNode& aNode){
//mBodyContext->Push(eHTMLTag_head);
nsresult result=NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
STOP_TIMER();
if(!mHasOpenHead++) {
result=(mSink) ? mSink->OpenHead(aNode) : NS_OK;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
START_TIMER();
return result;
@ -2343,12 +2342,12 @@ nsresult CNavDTD::CloseHead(const nsIParserNode& aNode){
if(mHasOpenHead) {
if(0==--mHasOpenHead){
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseHead(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
START_TIMER();
}
@ -2389,12 +2388,12 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
if(NS_OK==result) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->OpenBody(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
START_TIMER();
if(!theBodyIsOpen) {
@ -2417,12 +2416,12 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
nsresult CNavDTD::CloseBody(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->CloseBody(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2441,12 +2440,12 @@ nsresult CNavDTD::OpenForm(const nsIParserNode& aNode){
if(mHasOpenForm)
CloseForm(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenForm(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
START_TIMER();
if(NS_OK==result)
@ -2468,12 +2467,12 @@ nsresult CNavDTD::CloseForm(const nsIParserNode& aNode){
if(mHasOpenForm) {
mHasOpenForm=PR_FALSE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseForm(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
START_TIMER();
}
@ -2492,12 +2491,12 @@ nsresult CNavDTD::OpenMap(const nsIParserNode& aNode){
if(mHasOpenMap)
CloseMap(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenMap(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
START_TIMER();
if(NS_OK==result) {
@ -2521,12 +2520,12 @@ nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
if(mHasOpenMap) {
mHasOpenMap=PR_FALSE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseMap(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2547,12 +2546,12 @@ nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
mHadFrameset=PR_TRUE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
START_TIMER();
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
@ -2571,12 +2570,12 @@ nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
nsresult CNavDTD::CloseFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() > 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->CloseFrameset(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2659,12 +2658,12 @@ CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aClosedByStartTag){
default:
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->OpenContainer(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
START_TIMER();
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
@ -2731,12 +2730,12 @@ CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aClosed
case eHTMLTag_title:
default:
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseContainer(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2861,12 +2860,12 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
eHTMLTags theTag=(eHTMLTags)aNode.GetNodeType();
OpenTransientStyles(theTag);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
STOP_TIMER();
result=mSink->AddLeaf(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
START_TIMER();
if(NS_SUCCEEDED(result)) {
@ -2886,7 +2885,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
theToken=mTokenizer->PopToken();
theNode->Init(theToken,mLineNumber,0);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
STOP_TIMER();
result=mSink->AddLeaf(*theNode);
@ -2898,7 +2897,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
else delete theToken;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
START_TIMER();
thePrevTag=theTag;
}
@ -2909,7 +2908,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
theToken=mTokenizer->PopToken();
theNode->Init(theToken,mLineNumber);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
STOP_TIMER();
result=mSink->AddLeaf(*theNode);
@ -2921,7 +2920,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
else delete theToken;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
START_TIMER();
}
else done=PR_TRUE;
@ -2973,10 +2972,10 @@ nsresult CNavDTD::AddHeadLeaf(nsIParserNode& aNode){
nsString* theStr=(nsString*)&theString;
theStr->CompressWhitespace();
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
STOP_TIMER()
mSink->SetTitle(theString);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
START_TIMER()
}
@ -3123,12 +3122,12 @@ nsITokenizer* CNavDTD::GetTokenizer(void) {
*/
nsresult CNavDTD::WillResumeParse(void){
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->WillResume() : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
START_TIMER();
return result;
@ -3142,12 +3141,12 @@ nsresult CNavDTD::WillResumeParse(void){
*/
nsresult CNavDTD::WillInterruptParse(void){
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->WillInterrupt() : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
START_TIMER();
return result;

Просмотреть файл

@ -207,12 +207,10 @@ nsParser::nsParser(nsITokenObserver* anObserver) : mCommand(""), mUnusedInput(""
mCharsetSource=kCharsetUninitialized;
mInternalState=NS_OK;
#ifdef MOZ_PERF_METRICS
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset: Parse Time: nsParser::nsParser(), this=%p\n", this));
mParseTime.Reset();
mDTDTime.Reset();
mTokenizeTime.Reset();
#endif
MOZ_TIMER_DEBUGLOG(("Reset: Parse Time: nsParser::nsParser(), this=%p\n", this));
MOZ_TIMER_RESET(mParseTime);
MOZ_TIMER_RESET(mDTDTime);
MOZ_TIMER_RESET(mTokenizeTime);
}
@ -660,7 +658,6 @@ nsresult nsParser::Terminate(void){
* @return current state
*/
nsresult nsParser::EnableParser(PRBool aState){
NS_START_STOPWATCH(mTotalTime)
nsIParser* me = nsnull;
// If the stream has already finished, there's a good chance
@ -681,11 +678,9 @@ nsresult nsParser::EnableParser(PRBool aState){
result=mInternalState;
}
else {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: nsParser::EnableParser(), this=%p\n", this));
NS_STOP_STOPWATCH(mParseTime);
}
NS_STOP_STOPWATCH(mTotalTime)
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::EnableParser(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
}
// Release reference if we added one at the top of this routine
NS_IF_RELEASE(me);
@ -714,8 +709,7 @@ PRBool nsParser::IsParserEnabled() {
* @param aFilename -- const char* containing file to be parsed.
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,eParseMode aMode) {
NS_START_STOPWATCH(mTotalTime)
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,eParseMode aMode) {
NS_PRECONDITION(0!=aURL,kNullURL);
@ -724,8 +718,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
if(aURL) {
char* spec;
nsresult rv = aURL->GetSpec(&spec);
if (rv != NS_OK) {
NS_STOP_STOPWATCH(mTotalTime)
if (rv != NS_OK) {
return rv;
}
nsAutoString theName(spec);
@ -742,8 +735,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
else{
result=mInternalState=NS_ERROR_HTMLPARSER_BADCONTEXT;
}
}
NS_STOP_STOPWATCH(mTotalTime)
}
return result;
}
@ -755,7 +747,6 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aKey,eParseMode aMode){
NS_START_STOPWATCH(mTotalTime)
mDTDVerification=aVerifyEnabled;
nsresult result=NS_ERROR_OUT_OF_MEMORY;
@ -780,8 +771,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aK
}
else{
result=mInternalState=NS_ERROR_HTMLPARSER_BADCONTEXT;
}
NS_STOP_STOPWATCH(mTotalTime)
}
return result;
}
@ -799,8 +789,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aK
nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aVerifyEnabled,PRBool aLastCall,eParseMode aMode){
//NOTE: Make sure that updates to this method don't cause
// bug #2361 to break again!
NS_START_STOPWATCH(mTotalTime)
// bug #2361 to break again!
nsresult result=NS_OK;
nsParser* me = this;
@ -824,8 +813,7 @@ nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString
mUnusedInput.Truncate(0);
}
else {
NS_RELEASE(me);
NS_STOP_STOPWATCH(mTotalTime)
NS_RELEASE(me);
return NS_ERROR_OUT_OF_MEMORY;
}
}
@ -847,8 +835,7 @@ nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString
delete pc;
}//if
}//if
NS_RELEASE(me);
NS_STOP_STOPWATCH(mTotalTime)
NS_RELEASE(me);
return result;
}
@ -951,8 +938,8 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
nsresult result=NS_OK;
if(mParserContext->mParserEnabled && mInternalState!=NS_ERROR_HTMLPARSER_STOPPARSING) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
NS_START_STOPWATCH(mParseTime)
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_START(mParseTime);
result=WillBuildModel(mParserContext->mScanner->GetFilename(),aDefaultDTD);
if(mParserContext->mDTD) {
@ -966,36 +953,20 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
if((!mParserContext->mMultipart) || (mInternalState==NS_ERROR_HTMLPARSER_STOPPARSING) ||
((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){
DidBuildModel(mStreamStatus);
NS_STOP_STOPWATCH(mTotalTime);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
NS_STOP_STOPWATCH(mParseTime);
DidBuildModel(mStreamStatus);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
#ifdef MOZ_PERF_METRICS
// XXX Don't print out Gecko layout time till I make the save/restore
// implementation use a stack. We'll calculate page load + layout time
// in the webshell and print that out for now because that is more easy to
// measure. There are cases where one can't simply use the parser as the
// place to calculate Gecko layout time because the parser can go away
// before the higher level layout processes finish. I'll re-enable gecko layout
// time once we've identified the "best" way to isolate and measure it.
// printf("Total Time: ");
// mTotalTime.Print();
// printf("\n");
RAPTOR_STOPWATCH_TRACE(("Parse Time (this=%p): ", this));
mParseTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_LOG(("Parse Time (this=%p): ", this));
MOZ_TIMER_PRINT(mParseTime);
RAPTOR_STOPWATCH_TRACE(("DTD Time: "));
mDTDTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_LOG(("DTD Time: "));
MOZ_TIMER_PRINT(mDTDTime);
MOZ_TIMER_LOG(("Tokenize Time: "));
MOZ_TIMER_PRINT(mTokenizeTime);
RAPTOR_STOPWATCH_TRACE(("Tokenize Time: "));
mTokenizeTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
#endif
return mInternalState;
}
else {
@ -1015,8 +986,8 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
}
}//if
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
NS_STOP_STOPWATCH(mParseTime);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
return result;
}
@ -1048,9 +1019,9 @@ nsresult nsParser::BuildModel() {
nsIDTD* theRootDTD=theRootContext->mDTD;
if(theRootDTD) {
NS_START_STOPWATCH(mDTDTime);
MOZ_TIMER_START(mDTDTime);
result=theRootDTD->BuildModel(this,theTokenizer,mTokenObserver,mSink);
NS_STOP_STOPWATCH(mDTDTime);
MOZ_TIMER_STOP(mDTDTime);
}
}
else{
@ -1271,15 +1242,6 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail==mParserContext->mStreamListenerState)),kOnStartNotCalled);
#ifdef MOZ_PERF_METRICS
if (0 == sourceOffset) {
NS_RESET_AND_START_STOPWATCH(mTotalTime);
}
else {
NS_START_STOPWATCH(mTotalTime);
}
#endif
if(eInvalidDetect==mParserContext->mAutoDetectStatus) {
if(mParserContext->mScanner) {
mParserContext->mScanner->GetBuffer().Truncate();
@ -1336,8 +1298,7 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
theStartPos+=theNumRead;
}//while
result=ResumeParse();
NS_STOP_STOPWATCH(mTotalTime);
result=ResumeParse();
return result;
}
@ -1351,8 +1312,7 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
*/
nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
nsresult status, const PRUnichar* aMsg)
{
NS_START_STOPWATCH(mTotalTime)
{
nsresult result=NS_OK;
@ -1373,8 +1333,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
mParserContext->mScanner->SetIncremental(PR_FALSE);
result=ResumeParse(nsnull, PR_TRUE);
NS_STOP_STOPWATCH(mTotalTime)
// If the parser isn't enabled, we don't finish parsing till
// it is reenabled.
@ -1436,7 +1395,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
nsITokenizer* theTokenizer=mParserContext->mDTD->GetTokenizer();
if(theTokenizer){
NS_START_STOPWATCH(mTokenizeTime);
MOZ_TIMER_START(mTokenizeTime);
WillTokenize(aIsFinalChunk);
while(NS_SUCCEEDED(result)) {
@ -1455,7 +1414,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
}
DidTokenize(aIsFinalChunk);
NS_STOP_STOPWATCH(mTokenizeTime);
MOZ_TIMER_STOP(mTokenizeTime);
}
else{

Просмотреть файл

@ -68,7 +68,7 @@
#include "nsITokenizer.h"
#include "nsHTMLTags.h"
#include "nsDTDUtils.h"
#include "stopwatch.h"
#include "nsTimer.h"
class IContentSink;
class nsIDTD;
@ -383,14 +383,10 @@ protected:
nsresult mInternalState;
CObserverService mObserverService;
#ifdef MOZ_PERF_METRICS
public:
Stopwatch mTotalTime;
Stopwatch mParseTime;
Stopwatch mDTDTime;
Stopwatch mTokenizeTime;
#endif
public:
MOZ_TIMER_DECLARE(mParseTime);
MOZ_TIMER_DECLARE(mDTDTime);
MOZ_TIMER_DECLARE(mTokenizeTime);
};
#endif

Просмотреть файл

@ -69,7 +69,7 @@
#include "nsILayoutHistoryState.h"
#include "nsIScrollPositionListener.h"
#include "nsICompositeListener.h"
#include "stopwatch.h"
#include "nsTimer.h"
#include "nsWeakPtr.h"
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
@ -379,10 +379,8 @@ protected:
PRBool mPendingReflowEvent;
nsCOMPtr<nsIEventQueue> mEventQueue;
#ifdef MOZ_PERF_METRICS
Stopwatch mReflowWatch; // Used for measuring time spent in reflow
Stopwatch mFrameCreationWatch; // Used for measuring time spent in frame creation
#endif
MOZ_TIMER_DECLARE(mReflowWatch); // Used for measuring time spent in reflow
MOZ_TIMER_DECLARE(mFrameCreationWatch); // Used for measuring time spent in frame creation
#ifdef DEBUG_nisheeth
PRInt32 mReflows;
@ -944,8 +942,9 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
mFrameManager->GetRootFrame(&rootFrame);
if (nsnull != root) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_RESET(mFrameCreationWatch);
MOZ_TIMER_START(mFrameCreationWatch);
if (!rootFrame) {
// Have style sheet processor construct a frame for the
@ -959,13 +958,14 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
mStyleSet->ContentInserted(mPresContext, nsnull, root, 0);
NS_RELEASE(root);
VERIFY_STYLE_TREE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
NS_STOP_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
}
if (rootFrame) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_RESET(mReflowWatch);
MOZ_TIMER_START(mReflowWatch);
// Kick off a top-down reflow
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight));
@ -1009,8 +1009,8 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
VERIFY_STYLE_TREE;
NS_IF_RELEASE(rcx);
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow"));
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Reflow: PresShell::InitialReflow(), this=%p\n", this));
NS_STOP_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_STOP(mReflowWatch);
}
ExitReflowLock(PR_TRUE, PR_TRUE);
@ -1350,7 +1350,7 @@ PresShell::BeginLoad(nsIDocument *aDocument)
nsresult rv = NS_OK;
nsCOMPtr<nsITimeRecorder> watch = do_QueryInterface(mStyleSet, &rv);
if (NS_SUCCEEDED(rv) && watch) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset: Style Resolution: PresShell::BeginLoad(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Reset: Style Resolution: PresShell::BeginLoad(), this=%p\n", this));
watch->ResetTimer(NS_TIMER_STYLE_RESOLUTION);
}
#endif
@ -1376,27 +1376,24 @@ PresShell::EndLoad(nsIDocument *aDocument)
#ifdef MOZ_PERF_METRICS
// Dump reflow, style resolution and frame construction times here.
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Reflow: PresShell::EndLoad(), this=%p\n", this));
NS_STOP_STOPWATCH(mReflowWatch)
RAPTOR_STOPWATCH_TRACE(("Reflow time (this=%p): ", this));
mReflowWatch.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::EndLoad(), this=%p\n", this));
MOZ_TIMER_STOP(mReflowWatch);
MOZ_TIMER_LOG(("Reflow time (this=%p): ", this));
MOZ_TIMER_PRINT(mReflowWatch);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::EndLoad(), this=%p\n", this));
NS_STOP_STOPWATCH(mFrameCreationWatch)
RAPTOR_STOPWATCH_TRACE(("Frame construction plus style resolution time (this=%p): ", this));
mFrameCreationWatch.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::EndLoad(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
MOZ_TIMER_LOG(("Frame construction plus style resolution time (this=%p): ", this));
MOZ_TIMER_PRINT(mFrameCreationWatch);
// Print style resolution stopwatch maintained by style set
nsresult rv = NS_OK;
nsCOMPtr<nsITimeRecorder> watch = do_QueryInterface(mStyleSet, &rv);
if (NS_SUCCEEDED(rv) && watch) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Style Resolution: PresShell::EndLoad(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Style Resolution: PresShell::EndLoad(), this=%p\n", this));
watch->StopTimer(NS_TIMER_STYLE_RESOLUTION);
RAPTOR_STOPWATCH_TRACE(("Style resolution time (this=%p): ", this));
watch->PrintTimer(NS_TIMER_STYLE_RESOLUTION);
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_LOG(("Style resolution time (this=%p): ", this));
watch->PrintTimer(NS_TIMER_STYLE_RESOLUTION);
}
#endif
return NS_OK;
@ -1574,8 +1571,8 @@ PresShell::PostReflowEvent()
NS_IMETHODIMP
PresShell::ProcessReflowCommands()
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
NS_START_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Start: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
MOZ_TIMER_START(mReflowWatch);
if (0 != mReflowCommands.Count()) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsIRenderingContext* rcx;
@ -1649,8 +1646,8 @@ PresShell::ProcessReflowCommands()
#endif
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
NS_STOP_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
MOZ_TIMER_STOP(mReflowWatch);
return NS_OK;
}
@ -2046,8 +2043,8 @@ PresShell::ContentAppended(nsIDocument *aDocument,
PRInt32 aNewIndexInContainer)
{
EnterReflowLock();
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
NS_START_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Start: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_START(mFrameCreationWatch);
nsresult rv = mStyleSet->ContentAppended(mPresContext, aContainer, aNewIndexInContainer);
VERIFY_STYLE_TREE;
@ -2061,8 +2058,8 @@ PresShell::ContentAppended(nsIDocument *aDocument,
mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
NS_STOP_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
ExitReflowLock(PR_TRUE, PR_FALSE);
return rv;
}

Просмотреть файл

@ -34,7 +34,7 @@
#include "nsIDocument.h"
#include "nsIStyleFrameConstruction.h"
#include "nsLayoutAtoms.h"
#include "stopwatch.h"
#include "nsTimer.h"
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
#endif
@ -200,9 +200,7 @@ protected:
nsIStyleFrameConstruction* mFrameConstructor;
#ifdef MOZ_PERF_METRICS
Stopwatch mStyleResolutionWatch;
#endif
MOZ_TIMER_DECLARE(mStyleResolutionWatch);
};
StyleSetImpl::StyleSetImpl()
@ -621,8 +619,8 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aContent, "must have content");
@ -665,8 +663,8 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -711,8 +709,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
@ -757,8 +755,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -768,8 +766,8 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
@ -813,8 +811,8 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -1107,7 +1105,7 @@ StyleSetImpl::ResetTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Reset();
MOZ_TIMER_RESET(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1121,7 +1119,7 @@ StyleSetImpl::StartTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Start();
MOZ_TIMER_START(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1135,7 +1133,7 @@ StyleSetImpl::StopTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Stop();
MOZ_TIMER_STOP(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1149,7 +1147,7 @@ StyleSetImpl::PrintTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Print();
MOZ_TIMER_PRINT(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;

Просмотреть файл

@ -69,7 +69,7 @@
#include "nsILayoutHistoryState.h"
#include "nsIScrollPositionListener.h"
#include "nsICompositeListener.h"
#include "stopwatch.h"
#include "nsTimer.h"
#include "nsWeakPtr.h"
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
@ -379,10 +379,8 @@ protected:
PRBool mPendingReflowEvent;
nsCOMPtr<nsIEventQueue> mEventQueue;
#ifdef MOZ_PERF_METRICS
Stopwatch mReflowWatch; // Used for measuring time spent in reflow
Stopwatch mFrameCreationWatch; // Used for measuring time spent in frame creation
#endif
MOZ_TIMER_DECLARE(mReflowWatch); // Used for measuring time spent in reflow
MOZ_TIMER_DECLARE(mFrameCreationWatch); // Used for measuring time spent in frame creation
#ifdef DEBUG_nisheeth
PRInt32 mReflows;
@ -944,8 +942,9 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
mFrameManager->GetRootFrame(&rootFrame);
if (nsnull != root) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_RESET(mFrameCreationWatch);
MOZ_TIMER_START(mFrameCreationWatch);
if (!rootFrame) {
// Have style sheet processor construct a frame for the
@ -959,13 +958,14 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
mStyleSet->ContentInserted(mPresContext, nsnull, root, 0);
NS_RELEASE(root);
VERIFY_STYLE_TREE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
NS_STOP_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
}
if (rootFrame) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_RESET(mReflowWatch);
MOZ_TIMER_START(mReflowWatch);
// Kick off a top-down reflow
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight));
@ -1009,8 +1009,8 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
VERIFY_STYLE_TREE;
NS_IF_RELEASE(rcx);
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow"));
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Reflow: PresShell::InitialReflow(), this=%p\n", this));
NS_STOP_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::InitialReflow(), this=%p\n", this));
MOZ_TIMER_STOP(mReflowWatch);
}
ExitReflowLock(PR_TRUE, PR_TRUE);
@ -1350,7 +1350,7 @@ PresShell::BeginLoad(nsIDocument *aDocument)
nsresult rv = NS_OK;
nsCOMPtr<nsITimeRecorder> watch = do_QueryInterface(mStyleSet, &rv);
if (NS_SUCCEEDED(rv) && watch) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset: Style Resolution: PresShell::BeginLoad(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Reset: Style Resolution: PresShell::BeginLoad(), this=%p\n", this));
watch->ResetTimer(NS_TIMER_STYLE_RESOLUTION);
}
#endif
@ -1376,27 +1376,24 @@ PresShell::EndLoad(nsIDocument *aDocument)
#ifdef MOZ_PERF_METRICS
// Dump reflow, style resolution and frame construction times here.
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Reflow: PresShell::EndLoad(), this=%p\n", this));
NS_STOP_STOPWATCH(mReflowWatch)
RAPTOR_STOPWATCH_TRACE(("Reflow time (this=%p): ", this));
mReflowWatch.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::EndLoad(), this=%p\n", this));
MOZ_TIMER_STOP(mReflowWatch);
MOZ_TIMER_LOG(("Reflow time (this=%p): ", this));
MOZ_TIMER_PRINT(mReflowWatch);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::EndLoad(), this=%p\n", this));
NS_STOP_STOPWATCH(mFrameCreationWatch)
RAPTOR_STOPWATCH_TRACE(("Frame construction plus style resolution time (this=%p): ", this));
mFrameCreationWatch.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::EndLoad(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
MOZ_TIMER_LOG(("Frame construction plus style resolution time (this=%p): ", this));
MOZ_TIMER_PRINT(mFrameCreationWatch);
// Print style resolution stopwatch maintained by style set
nsresult rv = NS_OK;
nsCOMPtr<nsITimeRecorder> watch = do_QueryInterface(mStyleSet, &rv);
if (NS_SUCCEEDED(rv) && watch) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Style Resolution: PresShell::EndLoad(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Style Resolution: PresShell::EndLoad(), this=%p\n", this));
watch->StopTimer(NS_TIMER_STYLE_RESOLUTION);
RAPTOR_STOPWATCH_TRACE(("Style resolution time (this=%p): ", this));
watch->PrintTimer(NS_TIMER_STYLE_RESOLUTION);
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_LOG(("Style resolution time (this=%p): ", this));
watch->PrintTimer(NS_TIMER_STYLE_RESOLUTION);
}
#endif
return NS_OK;
@ -1574,8 +1571,8 @@ PresShell::PostReflowEvent()
NS_IMETHODIMP
PresShell::ProcessReflowCommands()
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
NS_START_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Start: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
MOZ_TIMER_START(mReflowWatch);
if (0 != mReflowCommands.Count()) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsIRenderingContext* rcx;
@ -1649,8 +1646,8 @@ PresShell::ProcessReflowCommands()
#endif
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
NS_STOP_STOPWATCH(mReflowWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
MOZ_TIMER_STOP(mReflowWatch);
return NS_OK;
}
@ -2046,8 +2043,8 @@ PresShell::ContentAppended(nsIDocument *aDocument,
PRInt32 aNewIndexInContainer)
{
EnterReflowLock();
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
NS_START_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Start: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_START(mFrameCreationWatch);
nsresult rv = mStyleSet->ContentAppended(mPresContext, aContainer, aNewIndexInContainer);
VERIFY_STYLE_TREE;
@ -2061,8 +2058,8 @@ PresShell::ContentAppended(nsIDocument *aDocument,
mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
NS_STOP_STOPWATCH(mFrameCreationWatch)
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
MOZ_TIMER_STOP(mFrameCreationWatch);
ExitReflowLock(PR_TRUE, PR_FALSE);
return rv;
}

Просмотреть файл

@ -80,7 +80,7 @@
#include "nsIStyleSheetLinkingElement.h"
#include "nsIDOMHTMLTitleElement.h"
#include "stopwatch.h"
#include "nsTimer.h"
#include "nsDOMError.h"
static NS_DEFINE_IID(kIDOMHTMLTitleElementIID, NS_IDOMHTMLTITLEELEMENT_IID);
@ -285,9 +285,7 @@ public:
void ForceReflow();
#endif
#ifdef MOZ_PERF_METRICS
Stopwatch mWatch; // Measures content model creation time for current document
#endif
MOZ_TIMER_DECLARE(mWatch); // Measures content model creation time for current document
};
class SinkContext {
@ -1918,15 +1916,16 @@ HTMLContentSink::Init(nsIDocument* aDoc,
nsIURI* aURL,
nsIWebShell* aContainer)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: nsHTMLContentSink::Init(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Reset and start: nsHTMLContentSink::Init(), this=%p\n", this));
MOZ_TIMER_RESET(mWatch);
MOZ_TIMER_START(mWatch);
NS_PRECONDITION(nsnull != aDoc, "null ptr");
NS_PRECONDITION(nsnull != aURL, "null ptr");
NS_PRECONDITION(nsnull != aContainer, "null ptr");
if ((nsnull == aDoc) || (nsnull == aURL) || (nsnull == aContainer)) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_NULL_POINTER;
}
@ -1953,8 +1952,8 @@ HTMLContentSink::Init(nsIDocument* aDoc,
// Make root part
nsresult rv = NS_NewHTMLHtmlElement(&mRoot, nsHTMLAtoms::html);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
mRoot->SetDocument(mDocument, PR_FALSE);
@ -1963,15 +1962,15 @@ HTMLContentSink::Init(nsIDocument* aDoc,
// Make head part
nsIAtom* atom = NS_NewAtom("head");
if (nsnull == atom) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_OUT_OF_MEMORY;
}
rv = NS_NewHTMLHeadElement(&mHead, atom);
NS_RELEASE(atom);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
mRoot->AppendChildTo(mHead, PR_FALSE);
@ -1987,8 +1986,8 @@ HTMLContentSink::Init(nsIDocument* aDoc,
this, spec));
nsCRT::free(spec);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::Init()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2005,11 +2004,10 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
{
// NRA Dump stopwatch stop info here
#ifdef MOZ_PERF_METRICS
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::DidBuildModel(), this=%p\n", this));
NS_STOP_STOPWATCH(mWatch)
RAPTOR_STOPWATCH_TRACE(("Content creation time (this=%p): ", this));
mWatch.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::DidBuildModel(), this=%p\n", this));
MOZ_TIMER_STOP(mWatch);
MOZ_TIMER_LOG(("Content creation time (this=%p): ", this));
MOZ_TIMER_PRINT(mWatch);
#endif
if (nsnull == mTitle) {
@ -2074,15 +2072,15 @@ HTMLContentSink::SetParser(nsIParser* aParser)
NS_IMETHODIMP
HTMLContentSink::BeginContext(PRInt32 aPosition)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::BeginContext()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::BeginContext()\n"));
MOZ_TIMER_START(mWatch);
NS_PRECONDITION(aPosition > -1, "out of bounds");
// Create new context
SinkContext* sc = new SinkContext(this);
if (nsnull == sc) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::BeginContext()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::BeginContext()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2110,16 +2108,16 @@ HTMLContentSink::BeginContext(PRInt32 aPosition)
mContextStack.AppendElement(mCurrentContext);
mCurrentContext = sc;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::BeginContext()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::BeginContext()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::EndContext(PRInt32 aPosition)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::EndContext()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::EndContext()\n"));
MOZ_TIMER_START(mWatch);
NS_PRECONDITION(mCurrentContext != nsnull && aPosition > -1, "non-existing context");
PRInt32 n = mContextStack.Count() - 1;
@ -2147,8 +2145,8 @@ HTMLContentSink::EndContext(PRInt32 aPosition)
mCurrentContext = sc;
mContextStack.RemoveElementAt(n);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::EndContext()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::EndContext()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2156,8 +2154,8 @@ HTMLContentSink::EndContext(PRInt32 aPosition)
NS_IMETHODIMP
HTMLContentSink::SetTitle(const nsString& aValue)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::SetTitle()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::SetTitle()\n"));
MOZ_TIMER_START(mWatch);
NS_ASSERTION(mCurrentContext == mHeadContext, "SetTitle not in head");
if (nsnull == mTitle) {
@ -2167,8 +2165,8 @@ HTMLContentSink::SetTitle(const nsString& aValue)
// If the title was already set then don't try to overwrite it
// when a new title is encountered - For backwards compatiblity
//*mTitle = aValue;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::SetTitle()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::SetTitle()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
ReduceEntities(*mTitle);
@ -2196,8 +2194,8 @@ HTMLContentSink::SetTitle(const nsString& aValue)
NS_RELEASE(it);
}
NS_RELEASE(atom);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::SetTitle()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::SetTitle()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2205,19 +2203,19 @@ NS_IMETHODIMP
HTMLContentSink::OpenHTML(const nsIParserNode& aNode)
{
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenHTML", aNode, 0, this);
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::CloseHTML(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseHTML()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseHTML()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseHTML", aNode, 0, this);
if (nsnull != mHeadContext) {
@ -2225,31 +2223,31 @@ HTMLContentSink::CloseHTML(const nsIParserNode& aNode)
delete mHeadContext;
mHeadContext = nsnull;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseHTML()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseHTML()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::OpenHead(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenHead()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenHead", aNode, 0, this);
nsresult rv = NS_OK;
if (nsnull == mHeadContext) {
mHeadContext = new SinkContext(this);
if (nsnull == mHeadContext) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_OUT_OF_MEMORY;
}
mHeadContext->SetPreAppend(PR_TRUE);
rv = mHeadContext->Begin(eHTMLTag_head, mHead, 0, -1);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
}
@ -2262,32 +2260,32 @@ HTMLContentSink::OpenHead(const nsIParserNode& aNode)
NS_IF_RELEASE(sco);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenHead()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseHead(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseHead()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseHead()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseHead", aNode,
0, this);
PRInt32 n = mContextStack.Count() - 1;
mCurrentContext = (SinkContext*) mContextStack.ElementAt(n);
mContextStack.RemoveElementAt(n);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseHead()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseHead()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::OpenBody(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenBody()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_START(mWatch);
//NS_PRECONDITION(nsnull == mBody, "parser called OpenBody twice");
SINK_TRACE_NODE(SINK_TRACE_CALLS,
@ -2298,8 +2296,8 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode)
nsIScriptContextOwner* sco = mDocument->GetScriptContextOwner();
AddAttributes(aNode,mBody,sco,PR_TRUE);
NS_IF_RELEASE(sco);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
@ -2309,15 +2307,15 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode)
nsresult rv = mCurrentContext->OpenContainer(aNode);
mCurrentContext->SetPreAppend(PR_FALSE);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
mBody = mCurrentContext->mStack[mCurrentContext->mStackPos - 1].mContent;
NS_ADDREF(mBody);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenBody()\n"));
MOZ_TIMER_STOP(mWatch);
StartLayout();
return NS_OK;
}
@ -2325,8 +2323,8 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode)
NS_IMETHODIMP
HTMLContentSink::CloseBody(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseBody()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseBody()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseBody", aNode,
mCurrentContext->mStackPos-1, this);
@ -2334,8 +2332,8 @@ HTMLContentSink::CloseBody(const nsIParserNode& aNode)
PRBool didFlush;
nsresult rv = mCurrentContext->FlushTextAndRelease(&didFlush);
if (NS_OK != rv) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseBody()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
// Flush out anything that's left
@ -2344,16 +2342,16 @@ HTMLContentSink::CloseBody(const nsIParserNode& aNode)
mCurrentContext->FlushTags();
mCurrentContext->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseBody()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseBody()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::OpenForm(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenForm()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenForm()\n"));
MOZ_TIMER_START(mWatch);
nsresult result = NS_OK;
nsIHTMLContent* content = nsnull;
@ -2406,8 +2404,8 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode)
mHTMLDocument->AddForm(mCurrentForm);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenForm()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenForm()\n"));
MOZ_TIMER_STOP(mWatch);
return result;
}
@ -2416,8 +2414,8 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode)
NS_IMETHODIMP
HTMLContentSink::CloseForm(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseForm()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseForm()\n"));
MOZ_TIMER_START(mWatch);
nsresult result = NS_OK;
mCurrentContext->FlushTextAndRelease();
@ -2437,16 +2435,16 @@ HTMLContentSink::CloseForm(const nsIParserNode& aNode)
NS_RELEASE(mCurrentForm);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseForm()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseForm()\n"));
MOZ_TIMER_STOP(mWatch);
return result;
}
NS_IMETHODIMP
HTMLContentSink::OpenFrameset(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenFrameset()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenFrameset()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenFrameset", aNode,
mCurrentContext->mStackPos, this);
@ -2456,16 +2454,16 @@ HTMLContentSink::OpenFrameset(const nsIParserNode& aNode)
mFrameset = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;
NS_ADDREF(mFrameset);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenFrameset()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenFrameset()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseFrameset()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseFrameset()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseFrameset", aNode,
mCurrentContext->mStackPos-1, this);
@ -2474,8 +2472,8 @@ HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
nsIHTMLContent* fs = sc->mStack[sc->mStackPos-1].mContent;
PRBool done = fs == mFrameset;
nsresult rv = sc->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseFrameset()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseFrameset()\n"));
MOZ_TIMER_STOP(mWatch);
if (done) {
StartLayout();
}
@ -2485,8 +2483,8 @@ HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
NS_IMETHODIMP
HTMLContentSink::OpenMap(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenMap()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenMap()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenMap", aNode,
@ -2496,16 +2494,16 @@ HTMLContentSink::OpenMap(const nsIParserNode& aNode)
// HTML 4.0 says that MAP elements can have block content
// as children.
rv = mCurrentContext->OpenContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenMap()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenMap()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseMap(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseMap()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseMap()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseMap", aNode,
@ -2513,52 +2511,52 @@ HTMLContentSink::CloseMap(const nsIParserNode& aNode)
NS_IF_RELEASE(mCurrentMap);
rv = mCurrentContext->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseMap()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseMap()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::OpenContainer(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::OpenContainer()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
// XXX work around parser bug
if (eHTMLTag_frameset == aNode.GetNodeType()) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return OpenFrameset(aNode);
}
rv = mCurrentContext->OpenContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::OpenContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::CloseContainer(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::CloseContainer()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseContainer()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
// XXX work around parser bug
if (eHTMLTag_frameset == aNode.GetNodeType()) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return CloseFrameset(aNode);
}
rv = mCurrentContext->CloseContainer(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseContainer()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
NS_IMETHODIMP
HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::AddLeaf()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddLeaf()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv;
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
@ -2597,8 +2595,8 @@ HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
break;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::AddLeaf()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::AddLeaf()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
@ -2609,12 +2607,12 @@ HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
* @return error code
*/
nsresult HTMLContentSink::AddComment(const nsIParserNode& aNode) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::AddComment()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddComment()\n"));
MOZ_TIMER_START(mWatch);
nsresult rv = NS_OK;
rv = mCurrentContext->AddComment(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::AddComment()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::AddComment()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
@ -2626,10 +2624,10 @@ nsresult HTMLContentSink::AddComment(const nsIParserNode& aNode) {
*/
nsresult HTMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode) {
nsresult result= NS_OK;
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_START(mWatch);
// Implementation of AddProcessingInstruction() should start here
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_STOP(mWatch);
return result;
}
@ -2642,13 +2640,13 @@ NS_IMETHODIMP
HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
{
nsresult rv = NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: nsHTMLContentSink::AddDocTypeDecl()\n"));
NS_START_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddDocTypeDecl()\n"));
MOZ_TIMER_START(mWatch);
rv=mHTMLDocument->AddDocTypeDecl(aNode.GetText(),(nsDTDMode)aMode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::AddDocTypeDecl()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::AddDocTypeDecl()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;
}
@ -3469,12 +3467,12 @@ HTMLContentSink::ForceReflow()
void
HTMLContentSink::NotifyAppend(nsIContent* aContainer, PRInt32 aStartIndex)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Save and stop: nsHTMLContentSink::NotifyAppend()\n"));
NS_SAVE_STOPWATCH_STATE(mWatch)
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Save and stop: nsHTMLContentSink::NotifyAppend()\n"));
MOZ_TIMER_SAVE(mWatch)
MOZ_TIMER_STOP(mWatch);
mDocument->ContentAppended(aContainer, aStartIndex);
RAPTOR_STOPWATCH_DEBUGTRACE(("Restore: nsHTMLContentSink::NotifyAppend()\n"));
NS_RESTORE_STOPWATCH_STATE(mWatch)
MOZ_TIMER_DEBUGLOG(("Restore: nsHTMLContentSink::NotifyAppend()\n"));
MOZ_TIMER_RESTORE(mWatch);
}
void
@ -3482,12 +3480,12 @@ HTMLContentSink::NotifyInsert(nsIContent* aContent,
nsIContent* aChildContent,
PRInt32 aIndexInContainer)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Save and stop: nsHTMLContentSink::NotifyInsert()\n"));
NS_SAVE_STOPWATCH_STATE(mWatch)
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Save and stop: nsHTMLContentSink::NotifyInsert()\n"));
MOZ_TIMER_SAVE(mWatch)
MOZ_TIMER_STOP(mWatch);
mDocument->ContentInserted(aContent, aChildContent, aIndexInContainer);
RAPTOR_STOPWATCH_DEBUGTRACE(("Restore: nsHTMLContentSink::NotifyInsert()\n"));
NS_RESTORE_STOPWATCH_STATE(mWatch)
MOZ_TIMER_DEBUGLOG(("Restore: nsHTMLContentSink::NotifyInsert()\n"));
MOZ_TIMER_RESTORE(mWatch);
}
void
@ -3754,8 +3752,8 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
// Don't include script loading and evaluation in the stopwatch
// that is measuring content creation time
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::ProcessSCRIPTTag()\n"));
NS_STOP_STOPWATCH(mWatch)
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::ProcessSCRIPTTag()\n"));
MOZ_TIMER_STOP(mWatch);
// Don't process scripts that aren't JavaScript and don't process
// scripts that are inside iframes

Просмотреть файл

@ -34,7 +34,7 @@
#include "nsIDocument.h"
#include "nsIStyleFrameConstruction.h"
#include "nsLayoutAtoms.h"
#include "stopwatch.h"
#include "nsTimer.h"
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
#endif
@ -200,9 +200,7 @@ protected:
nsIStyleFrameConstruction* mFrameConstructor;
#ifdef MOZ_PERF_METRICS
Stopwatch mStyleResolutionWatch;
#endif
MOZ_TIMER_DECLARE(mStyleResolutionWatch);
};
StyleSetImpl::StyleSetImpl()
@ -621,8 +619,8 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aContent, "must have content");
@ -665,8 +663,8 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ResolveStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -711,8 +709,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
@ -757,8 +755,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -768,8 +766,8 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
NS_START_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_START(mStyleResolutionWatch);
nsIStyleContext* result = nsnull;
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
@ -813,8 +811,8 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
NS_STOP_STOPWATCH(mStyleResolutionWatch)
MOZ_TIMER_DEBUGLOG(("Stop: StyleSetImpl::ProbePseudoStyleFor(), this=%p\n", this));
MOZ_TIMER_STOP(mStyleResolutionWatch);
return result;
}
@ -1107,7 +1105,7 @@ StyleSetImpl::ResetTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Reset();
MOZ_TIMER_RESET(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1121,7 +1119,7 @@ StyleSetImpl::StartTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Start();
MOZ_TIMER_START(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1135,7 +1133,7 @@ StyleSetImpl::StopTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Stop();
MOZ_TIMER_STOP(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;
@ -1149,7 +1147,7 @@ StyleSetImpl::PrintTimer(PRUint32 aTimerID)
nsresult rv = NS_OK;
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
mStyleResolutionWatch.Print();
MOZ_TIMER_PRINT(mStyleResolutionWatch);
}
else
rv = NS_ERROR_NOT_IMPLEMENTED;

Просмотреть файл

@ -4,3 +4,5 @@
xp_obs.h
stopwatch.h
nsTimer.h
nsStackBasedTimer.h

Просмотреть файл

@ -29,7 +29,10 @@ include $(DEPTH)/config/autoconf.mk
MODULE = util
XPIDL_MODULE = util
EXPORTS = $(srcdir)/xp_obs.h $(srcdir)/stopwatch.h
EXPORTS = $(srcdir)/xp_obs.h \
$(srcdir)/stopwatch.h \
$(srcdir)/nsTimer.h \
$(srcdir)/nsStackBasedTimer.h
XPIDLSRCS = nsITimeRecorder.idl

Просмотреть файл

@ -31,7 +31,10 @@ XPIDLSRCS = \
.\nsITimeRecorder.idl \
$(NULL)
EXPORTS=xp_obs.h stopwatch.h
EXPORTS=xp_obs.h \
stopwatch.h \
nsTimer.h \
nsStackBasedTimer.h
!include $(DEPTH)\config\rules.mak

Просмотреть файл

@ -20,6 +20,8 @@
* Contributor(s):
*/
#ifdef __NSSTACKBASEDTIMER_H
#define __NSSTACKBASEDTIMER_H
#include "stopwatch.h"
class nsStackBasedTimer {
@ -35,4 +37,5 @@ public:
private:
Stopwatch* sw;
}
};
#endif // __NSSTACKBASEDTIMER_H

Просмотреть файл

@ -34,7 +34,7 @@
// Uncomment and re-build to use the Mac Instrumentation SDK on a Mac.
// #define MOZ_TIMER_USE_MAC_ISDK
// Uncomment and re-build to use the
// Uncomment and re-build to use Quantify on Windows
// #define MOZ_TIMER_USE_QUANTIFY
// Timer macros for the Mac
@ -43,9 +43,9 @@
#ifdef MOZ_TIMER_USE_MAC_ISDK
#include "InstrumentationHelpers.h"
# define MOZ_TIMER_CREATE(name, msg) \
static InstTraceClassRef name = 0; StInstrumentationLog __traceLog((msg), name)
# define MOZ_TIMER_DECLARE(name)
# define MOZ_TIMER_CREATE(name) \
static InstTraceClassRef name = 0; StInstrumentationLog __traceLog("Creating name..."), name)
# define MOZ_TIMER_RESET(name, msg)
# define MOZ_TIMER_START(name, msg)
@ -76,20 +76,22 @@
#ifdef MOZ_TIMER_USE_QUANTIFY
#include "pure.h"
# define MOZ_TIMER_DECLARE(name)
# define MOZ_TIMER_CREATE(name)
# define MOZ_TIMER_RESET(name) \
QuantifyClearData()
# define MOZ_TIMER_CREATE(name, msg)
# define MOZ_TIMER_RESET(name, msg) \
QuantifyClearData(); printf msg
# define MOZ_TIMER_START(name, msg) \
QuantifyStartRecordingData(); printf msg
# define MOZ_TIMER_START(name) \
QuantifyStartRecordingData()
# define MOZ_TIMER_STOP(name, msg) \
QuantifyStopRecordingData(); printf msg
# define MOZ_TIMER_STOP(name) \
QuantifyStopRecordingData()
# define MOZ_TIMER_SAVE(name, msg)
# define MOZ_TIMER_RESTORE(name, msg)
# define MOZ_TIMER_SAVE(name)
# define MOZ_TIMER_RESTORE(name)
# define MOZ_TIMER_PRINT(name)
# define MOZ_TIMER_LOG(msg) \
do { \
char* str = __mysprintf msg; \
@ -119,23 +121,29 @@ do { \
#ifdef MOZ_TIMER_USE_STOPWATCH
# define MOZ_TIMER_CREATE(name, msg) \
# define MOZ_TIMER_DECLARE(name) \
Stopwatch name;
# define MOZ_TIMER_CREATE(name) \
static Stopwatch __sw_name; nsStackBasedTimer name(&__sw_name)
# define MOZ_TIMER_RESET(name, msg) \
name.Reset(); printf msg
# define MOZ_TIMER_RESET(name) \
name.Reset();
# define MOZ_TIMER_START(name, msg) \
name.Start(PR_FALSE); printf msg
# define MOZ_TIMER_STOP(name, msg) \
name.Stop(); printf msg
# define MOZ_TIMER_START(name) \
name.Start(PR_FALSE);
# define MOZ_TIMER_SAVE(name, msg) \
name.SaveState(); printf msg
# define MOZ_TIMER_STOP(name) \
name.Stop();
# define MOZ_TIMER_RESTORE(name, msg) \
name.RestoreState(); printf msg
# define MOZ_TIMER_SAVE(name) \
name.SaveState();
# define MOZ_TIMER_RESTORE(name) \
name.RestoreState();
# define MOZ_TIMER_PRINT(name) \
name.Print();
# define MOZ_TIMER_LOG(msg) \
printf msg
@ -148,13 +156,15 @@ do { \
#endif // MOZ_TIMER_USE_STOPWATCH
#else
# define MOZ_TIMER_CREATE(name, msg)
# define MOZ_TIMER_RESET(name, msg)
# define MOZ_TIMER_START(name, msg)
# define MOZ_TIMER_STOP(name, msg)
# define MOZ_TIMER_SAVE(name, msg)
# define MOZ_TIMER_RESTORE(name, msg)
# define MOZ_TIMER_LOG(name, msg)
# define MOZ_TIMER_DECLARE(name)
# define MOZ_TIMER_CREATE(name)
# define MOZ_TIMER_RESET(name)
# define MOZ_TIMER_START(name)
# define MOZ_TIMER_STOP(name)
# define MOZ_TIMER_SAVE(name)
# define MOZ_TIMER_RESTORE(name)
# define MOZ_TIMER_PRINT(name)
# define MOZ_TIMER_LOG(msg)
# define MOZ_TIMER_DEBUGLOG(msg)
# define MOZ_TIMER_MACISDK_LOGDATA(msg, data)
#endif // MOZ_PERF_METRICS

Просмотреть файл

@ -223,9 +223,9 @@ void Stopwatch::Print(void) {
realt -= min * 60;
int sec = int(realt);
#ifdef MOZ_PERF_METRICS
RAPTOR_STOPWATCH_TRACE(("Real time %d:%d:%d, CP time %.3f", hours, min, sec, CpuTime()));
RAPTOR_STOPWATCH_TRACE(("Real time %d:%d:%d, CP time %.3f\n", hours, min, sec, CpuTime()));
#else
printf("Real time %d:%d:%d, CP time %.3f", hours, min, sec, CpuTime());
printf("Real time %d:%d:%d, CP time %.3f\n", hours, min, sec, CpuTime());
#endif
}

Просмотреть файл

@ -42,7 +42,6 @@
#include "nsViewSourceHTML.h"
#include "nsParserNode.h"
#include "nsHTMLEntities.h"
#include "stopwatch.h"
#ifdef XP_PC
#include <direct.h> //this is here for debug reasons...
@ -87,12 +86,12 @@ static eHTMLTags gWhitespaceTags[]={
#ifdef MOZ_PERF_METRICS
# define START_TIMER() \
if(mParser) mParser->mParseTime.Start(PR_FALSE); \
if(mParser) mParser->mDTDTime.Start(PR_FALSE);
if(mParser) MOZ_TIMER_START(mParser->mParseTime); \
if(mParser) MOZ_TIMER_START(mParser->mDTDTime);
# define STOP_TIMER() \
if(mParser) mParser->mParseTime.Stop(); \
if(mParser) mParser->mDTDTime.Stop();
if(mParser) MOZ_TIMER_STOP(mParser->mParseTime); \
if(mParser) MOZ_TIMER_STOP(mParser->mDTDTime);
#else
# define STOP_TIMER()
@ -413,7 +412,7 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
mParseMode=aParseMode;
if((aNotifySink) && (aSink)) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
STOP_TIMER();
if(aSink && (!mSink)) {
@ -421,7 +420,7 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
}
result = aSink->WillBuildModel();
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
START_TIMER();
nsAutoString theTagName("html");
@ -510,7 +509,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
}
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
STOP_TIMER();
#ifdef RICKG_DEBUG
@ -544,7 +543,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
result=aSink->DidBuildModel(0);
#endif
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this));
START_TIMER();
if(mDTDDebug) {
@ -757,13 +756,13 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
case eHTMLTag_xmp:
//grab the skipped content and dump it out as text...
{
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
STOP_TIMER()
const nsString& theText=aNode.GetSkippedContent();
if(0<theText.Length()) {
CViewSourceHTML::WriteText(theText,*mSink,PR_TRUE,PR_FALSE);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::DidHandleStartTag(), this=%p\n", this));
START_TIMER()
}
break;
@ -1029,7 +1028,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
result=CollectSkippedContent(aNode,theAttrCount);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
STOP_TIMER()
if(mParser) {
@ -1045,7 +1044,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
charsetValue,charsetSource);
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));
START_TIMER()
if(NS_SUCCEEDED(result)) {
@ -1257,13 +1256,13 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
case eHTMLTag_area:
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
STOP_TIMER();
if (mHasOpenMap && mSink)
result=mSink->AddLeaf(*theNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleStartToken(), this=%p\n", this));
START_TIMER();
break;
@ -1529,13 +1528,13 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
PRInt32 theBadTokenCount = mBodyContext->TokenCountAt(theBadContentIndex);
if(theBadTokenCount > 0) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
STOP_TIMER()
// Pause the main context and switch to the new context.
eHTMLTags theParentTag=mBodyContext->TagAt(theBadContentIndex);
mSink->BeginContext(theBadContentIndex);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
START_TIMER()
nsDTDContext temp;
@ -1580,11 +1579,11 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
for(PRInt32 k=0; k<(theTagCount - theTopIndex); k++)
mBodyContext->Push(temp.Pop());
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
STOP_TIMER()
// Terminate the new context and switch back to the main context
mSink->EndContext(theBadContentIndex);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
START_TIMER()
}
return result;
@ -1642,12 +1641,12 @@ nsresult CNavDTD::HandleCommentToken(CToken* aToken) {
WriteTokenToLog(aToken);
#endif
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->AddComment(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this));
START_TIMER();
return result;
@ -1719,12 +1718,12 @@ nsresult CNavDTD::HandleProcessingInstructionToken(CToken* aToken){
WriteTokenToLog(aToken);
#endif
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->AddProcessingInstruction(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this));
START_TIMER();
return result;
@ -1752,12 +1751,12 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){
docTypeStr.Trim("<!>");
nsCParserNode theNode((CHTMLToken*)aToken,mLineNumber,mTokenizer->GetTokenRecycler());
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
STOP_TIMER();
result = (mSink)? mSink->AddDocTypeDecl(theNode,mParseMode):NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
START_TIMER();
return result;
@ -2268,12 +2267,12 @@ nsresult CNavDTD::CloseTransientStyles(eHTMLTags aChildTag){
nsresult CNavDTD::OpenHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenHTML(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenHTML(), this=%p\n", this));
START_TIMER();
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
@ -2292,12 +2291,12 @@ nsresult CNavDTD::OpenHTML(const nsIParserNode& aNode){
nsresult CNavDTD::CloseHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() > 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->CloseHTML(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseHTML(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2317,14 +2316,14 @@ nsresult CNavDTD::OpenHead(const nsIParserNode& aNode){
//mBodyContext->Push(eHTMLTag_head);
nsresult result=NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
STOP_TIMER();
if(!mHasOpenHead++) {
result=(mSink) ? mSink->OpenHead(aNode) : NS_OK;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenHead(), this=%p\n", this));
START_TIMER();
return result;
@ -2343,12 +2342,12 @@ nsresult CNavDTD::CloseHead(const nsIParserNode& aNode){
if(mHasOpenHead) {
if(0==--mHasOpenHead){
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseHead(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseHead(), this=%p\n", this));
START_TIMER();
}
@ -2389,12 +2388,12 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
if(NS_OK==result) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->OpenBody(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
START_TIMER();
if(!theBodyIsOpen) {
@ -2417,12 +2416,12 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
nsresult CNavDTD::CloseBody(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->CloseBody(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseBody(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2441,12 +2440,12 @@ nsresult CNavDTD::OpenForm(const nsIParserNode& aNode){
if(mHasOpenForm)
CloseForm(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenForm(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenForm(), this=%p\n", this));
START_TIMER();
if(NS_OK==result)
@ -2468,12 +2467,12 @@ nsresult CNavDTD::CloseForm(const nsIParserNode& aNode){
if(mHasOpenForm) {
mHasOpenForm=PR_FALSE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseForm(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseForm(), this=%p\n", this));
START_TIMER();
}
@ -2492,12 +2491,12 @@ nsresult CNavDTD::OpenMap(const nsIParserNode& aNode){
if(mHasOpenMap)
CloseMap(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenMap(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenMap(), this=%p\n", this));
START_TIMER();
if(NS_OK==result) {
@ -2521,12 +2520,12 @@ nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
if(mHasOpenMap) {
mHasOpenMap=PR_FALSE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseMap(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseMap(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2547,12 +2546,12 @@ nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
mHadFrameset=PR_TRUE;
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenFrameset(), this=%p\n", this));
START_TIMER();
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
@ -2571,12 +2570,12 @@ nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
nsresult CNavDTD::CloseFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() > 0, kInvalidTagStackPos);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->CloseFrameset(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseFrameset(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2659,12 +2658,12 @@ CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aClosedByStartTag){
default:
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->OpenContainer(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
START_TIMER();
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
@ -2731,12 +2730,12 @@ CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aClosed
case eHTMLTag_title:
default:
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
STOP_TIMER();
result=(mSink) ? mSink->CloseContainer(aNode) : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseContainer(), this=%p\n", this));
START_TIMER();
mBodyContext->Pop();
@ -2861,12 +2860,12 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
eHTMLTags theTag=(eHTMLTags)aNode.GetNodeType();
OpenTransientStyles(theTag);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
STOP_TIMER();
result=mSink->AddLeaf(aNode);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
START_TIMER();
if(NS_SUCCEEDED(result)) {
@ -2886,7 +2885,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
theToken=mTokenizer->PopToken();
theNode->Init(theToken,mLineNumber,0);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
STOP_TIMER();
result=mSink->AddLeaf(*theNode);
@ -2898,7 +2897,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
else delete theToken;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
START_TIMER();
thePrevTag=theTag;
}
@ -2909,7 +2908,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
theToken=mTokenizer->PopToken();
theNode->Init(theToken,mLineNumber);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
STOP_TIMER();
result=mSink->AddLeaf(*theNode);
@ -2921,7 +2920,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
else delete theToken;
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
START_TIMER();
}
else done=PR_TRUE;
@ -2973,10 +2972,10 @@ nsresult CNavDTD::AddHeadLeaf(nsIParserNode& aNode){
nsString* theStr=(nsString*)&theString;
theStr->CompressWhitespace();
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
STOP_TIMER()
mSink->SetTitle(theString);
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddHeadLeaf(), this=%p\n", this));
START_TIMER()
}
@ -3123,12 +3122,12 @@ nsITokenizer* CNavDTD::GetTokenizer(void) {
*/
nsresult CNavDTD::WillResumeParse(void){
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->WillResume() : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
START_TIMER();
return result;
@ -3142,12 +3141,12 @@ nsresult CNavDTD::WillResumeParse(void){
*/
nsresult CNavDTD::WillInterruptParse(void){
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
STOP_TIMER();
nsresult result=(mSink) ? mSink->WillInterrupt() : NS_OK;
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
START_TIMER();
return result;

Просмотреть файл

@ -207,12 +207,10 @@ nsParser::nsParser(nsITokenObserver* anObserver) : mCommand(""), mUnusedInput(""
mCharsetSource=kCharsetUninitialized;
mInternalState=NS_OK;
#ifdef MOZ_PERF_METRICS
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset: Parse Time: nsParser::nsParser(), this=%p\n", this));
mParseTime.Reset();
mDTDTime.Reset();
mTokenizeTime.Reset();
#endif
MOZ_TIMER_DEBUGLOG(("Reset: Parse Time: nsParser::nsParser(), this=%p\n", this));
MOZ_TIMER_RESET(mParseTime);
MOZ_TIMER_RESET(mDTDTime);
MOZ_TIMER_RESET(mTokenizeTime);
}
@ -660,7 +658,6 @@ nsresult nsParser::Terminate(void){
* @return current state
*/
nsresult nsParser::EnableParser(PRBool aState){
NS_START_STOPWATCH(mTotalTime)
nsIParser* me = nsnull;
// If the stream has already finished, there's a good chance
@ -681,11 +678,9 @@ nsresult nsParser::EnableParser(PRBool aState){
result=mInternalState;
}
else {
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: nsParser::EnableParser(), this=%p\n", this));
NS_STOP_STOPWATCH(mParseTime);
}
NS_STOP_STOPWATCH(mTotalTime)
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::EnableParser(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
}
// Release reference if we added one at the top of this routine
NS_IF_RELEASE(me);
@ -714,8 +709,7 @@ PRBool nsParser::IsParserEnabled() {
* @param aFilename -- const char* containing file to be parsed.
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,eParseMode aMode) {
NS_START_STOPWATCH(mTotalTime)
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,eParseMode aMode) {
NS_PRECONDITION(0!=aURL,kNullURL);
@ -724,8 +718,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
if(aURL) {
char* spec;
nsresult rv = aURL->GetSpec(&spec);
if (rv != NS_OK) {
NS_STOP_STOPWATCH(mTotalTime)
if (rv != NS_OK) {
return rv;
}
nsAutoString theName(spec);
@ -742,8 +735,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
else{
result=mInternalState=NS_ERROR_HTMLPARSER_BADCONTEXT;
}
}
NS_STOP_STOPWATCH(mTotalTime)
}
return result;
}
@ -755,7 +747,6 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aKey,eParseMode aMode){
NS_START_STOPWATCH(mTotalTime)
mDTDVerification=aVerifyEnabled;
nsresult result=NS_ERROR_OUT_OF_MEMORY;
@ -780,8 +771,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aK
}
else{
result=mInternalState=NS_ERROR_HTMLPARSER_BADCONTEXT;
}
NS_STOP_STOPWATCH(mTotalTime)
}
return result;
}
@ -799,8 +789,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aK
nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aVerifyEnabled,PRBool aLastCall,eParseMode aMode){
//NOTE: Make sure that updates to this method don't cause
// bug #2361 to break again!
NS_START_STOPWATCH(mTotalTime)
// bug #2361 to break again!
nsresult result=NS_OK;
nsParser* me = this;
@ -824,8 +813,7 @@ nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString
mUnusedInput.Truncate(0);
}
else {
NS_RELEASE(me);
NS_STOP_STOPWATCH(mTotalTime)
NS_RELEASE(me);
return NS_ERROR_OUT_OF_MEMORY;
}
}
@ -847,8 +835,7 @@ nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString
delete pc;
}//if
}//if
NS_RELEASE(me);
NS_STOP_STOPWATCH(mTotalTime)
NS_RELEASE(me);
return result;
}
@ -951,8 +938,8 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
nsresult result=NS_OK;
if(mParserContext->mParserEnabled && mInternalState!=NS_ERROR_HTMLPARSER_STOPPARSING) {
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
NS_START_STOPWATCH(mParseTime)
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_START(mParseTime);
result=WillBuildModel(mParserContext->mScanner->GetFilename(),aDefaultDTD);
if(mParserContext->mDTD) {
@ -966,36 +953,20 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
if((!mParserContext->mMultipart) || (mInternalState==NS_ERROR_HTMLPARSER_STOPPARSING) ||
((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){
DidBuildModel(mStreamStatus);
NS_STOP_STOPWATCH(mTotalTime);
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
NS_STOP_STOPWATCH(mParseTime);
DidBuildModel(mStreamStatus);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
#ifdef MOZ_PERF_METRICS
// XXX Don't print out Gecko layout time till I make the save/restore
// implementation use a stack. We'll calculate page load + layout time
// in the webshell and print that out for now because that is more easy to
// measure. There are cases where one can't simply use the parser as the
// place to calculate Gecko layout time because the parser can go away
// before the higher level layout processes finish. I'll re-enable gecko layout
// time once we've identified the "best" way to isolate and measure it.
// printf("Total Time: ");
// mTotalTime.Print();
// printf("\n");
RAPTOR_STOPWATCH_TRACE(("Parse Time (this=%p): ", this));
mParseTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_LOG(("Parse Time (this=%p): ", this));
MOZ_TIMER_PRINT(mParseTime);
RAPTOR_STOPWATCH_TRACE(("DTD Time: "));
mDTDTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_LOG(("DTD Time: "));
MOZ_TIMER_PRINT(mDTDTime);
MOZ_TIMER_LOG(("Tokenize Time: "));
MOZ_TIMER_PRINT(mTokenizeTime);
RAPTOR_STOPWATCH_TRACE(("Tokenize Time: "));
mTokenizeTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
#endif
return mInternalState;
}
else {
@ -1015,8 +986,8 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
}
}//if
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
NS_STOP_STOPWATCH(mParseTime);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
return result;
}
@ -1048,9 +1019,9 @@ nsresult nsParser::BuildModel() {
nsIDTD* theRootDTD=theRootContext->mDTD;
if(theRootDTD) {
NS_START_STOPWATCH(mDTDTime);
MOZ_TIMER_START(mDTDTime);
result=theRootDTD->BuildModel(this,theTokenizer,mTokenObserver,mSink);
NS_STOP_STOPWATCH(mDTDTime);
MOZ_TIMER_STOP(mDTDTime);
}
}
else{
@ -1271,15 +1242,6 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail==mParserContext->mStreamListenerState)),kOnStartNotCalled);
#ifdef MOZ_PERF_METRICS
if (0 == sourceOffset) {
NS_RESET_AND_START_STOPWATCH(mTotalTime);
}
else {
NS_START_STOPWATCH(mTotalTime);
}
#endif
if(eInvalidDetect==mParserContext->mAutoDetectStatus) {
if(mParserContext->mScanner) {
mParserContext->mScanner->GetBuffer().Truncate();
@ -1336,8 +1298,7 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
theStartPos+=theNumRead;
}//while
result=ResumeParse();
NS_STOP_STOPWATCH(mTotalTime);
result=ResumeParse();
return result;
}
@ -1351,8 +1312,7 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
*/
nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
nsresult status, const PRUnichar* aMsg)
{
NS_START_STOPWATCH(mTotalTime)
{
nsresult result=NS_OK;
@ -1373,8 +1333,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
mParserContext->mScanner->SetIncremental(PR_FALSE);
result=ResumeParse(nsnull, PR_TRUE);
NS_STOP_STOPWATCH(mTotalTime)
// If the parser isn't enabled, we don't finish parsing till
// it is reenabled.
@ -1436,7 +1395,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
nsITokenizer* theTokenizer=mParserContext->mDTD->GetTokenizer();
if(theTokenizer){
NS_START_STOPWATCH(mTokenizeTime);
MOZ_TIMER_START(mTokenizeTime);
WillTokenize(aIsFinalChunk);
while(NS_SUCCEEDED(result)) {
@ -1455,7 +1414,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
}
DidTokenize(aIsFinalChunk);
NS_STOP_STOPWATCH(mTokenizeTime);
MOZ_TIMER_STOP(mTokenizeTime);
}
else{

Просмотреть файл

@ -68,7 +68,7 @@
#include "nsITokenizer.h"
#include "nsHTMLTags.h"
#include "nsDTDUtils.h"
#include "stopwatch.h"
#include "nsTimer.h"
class IContentSink;
class nsIDTD;
@ -383,14 +383,10 @@ protected:
nsresult mInternalState;
CObserverService mObserverService;
#ifdef MOZ_PERF_METRICS
public:
Stopwatch mTotalTime;
Stopwatch mParseTime;
Stopwatch mDTDTime;
Stopwatch mTokenizeTime;
#endif
public:
MOZ_TIMER_DECLARE(mParseTime);
MOZ_TIMER_DECLARE(mDTDTime);
MOZ_TIMER_DECLARE(mTokenizeTime);
};
#endif

Просмотреть файл

@ -69,7 +69,7 @@
#include "nsIDOMHTMLDocument.h"
#include "nsLayoutCID.h"
#include "nsIDOMRange.h"
#include "stopwatch.h"
#include "nsTimer.h"
#include "nsILocaleService.h"
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
@ -492,9 +492,7 @@ protected:
// if there is no mWindow, this will keep track of the bounds --dwc0001
nsRect mBounds;
#ifdef MOZ_PERF_METRICS
Stopwatch mTotalTime;
#endif
MOZ_TIMER_DECLARE(mTotalTime);
#ifdef DETECT_WEBSHELL_LEAKS
private:
@ -2075,13 +2073,14 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
nsresult rv = NS_OK;
rv = aUri->GetSpec(&url);
if (NS_SUCCEEDED(rv)) {
RAPTOR_STOPWATCH_TRACE(("*** Timing layout processes on url: '%s', webshell: %p\n", url, this));
MOZ_TIMER_LOG(("*** Timing layout processes on url: '%s', webshell: %p\n", url, this));
delete [] url;
}
}
RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: nsWebShell::DoLoadURL(), this=%p\n", this));
NS_RESET_AND_START_STOPWATCH(mTotalTime)
MOZ_TIMER_DEBUGLOG(("Reset and start: nsWebShell::DoLoadURL(), this=%p\n", this));
MOZ_TIMER_RESET(mTotalTime);
MOZ_TIMER_START(mTotalTime);
#endif
/* WebShell was primarily passing the buck when it came to streamObserver.
@ -3320,11 +3319,10 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIDocumentLoaderObserver * aWebShell)
{
#ifdef MOZ_PERF_METRICS
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsWebShell::OnEndDocumentLoad(), this=%p\n", this));
NS_STOP_STOPWATCH(mTotalTime)
RAPTOR_STOPWATCH_TRACE(("Total (Layout + Page Load) Time (webshell=%p): ", this));
mTotalTime.Print();
RAPTOR_STOPWATCH_TRACE(("\n"));
MOZ_TIMER_DEBUGLOG(("Stop: nsWebShell::OnEndDocumentLoad(), this=%p\n", this));
MOZ_TIMER_STOP(mTotalTime);
MOZ_TIMER_LOG(("Total (Layout + Page Load) Time (webshell=%p): ", this));
MOZ_TIMER_PRINT(mTotalTime);
#endif
nsresult rv = NS_ERROR_FAILURE;