diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 085a5cbd9a1c..81cc56504b3c 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -63,6 +63,7 @@ #include "nsIFrameManager.h" #include "nsISupportsPrimitives.h" #include "nsILayoutHistoryState.h" +#include "stopwatch.h" // Drag & Drop, Clipboard #include "nsWidgetsCID.h" @@ -177,7 +178,7 @@ public: NS_IMETHOD DoCopy(); NS_IMETHOD GetHistoryState(nsILayoutHistoryState** aLayoutHistoryState); - NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState); + NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState); //nsIViewObserver interface @@ -305,6 +306,12 @@ private: nsIFrame* GetCurrentEventFrame(); void PushCurrentEventFrame(); void PopCurrentEventFrame(); + +#ifdef RAPTOR_PERF_METRICS + Stopwatch mReflowWatch; // Used for measuring time spent in reflow + Stopwatch mFrameCreationWatch; // Used for measuring time spent in frame creation +#endif + }; #ifdef NS_DEBUG @@ -833,6 +840,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } if (nsnull != mRootFrame) { + NS_RESET_AND_START_STOPWATCH(mReflowWatch) // Kick off a top-down reflow NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight)); @@ -870,6 +878,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } NS_IF_RELEASE(rcx); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow")); + NS_STOP_STOPWATCH(mReflowWatch) } ExitReflowLock(); diff --git a/layout/html/base/src/makefile.win b/layout/html/base/src/makefile.win index d627dc056759..4c369a4aa767 100644 --- a/layout/html/base/src/makefile.win +++ b/layout/html/base/src/makefile.win @@ -24,6 +24,9 @@ DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN !if defined(XP_NEW_SELECTION) DEFINES = $(DEFINES) -DXP_NEW_SELECTION !endif +!if defined(MOZ_PERF) +DEFINES = $(DEFINES) -DRAPTOR_PERF_METRICS +!endif EXPORTS = \ nsIHTMLContent.h \ diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 085a5cbd9a1c..81cc56504b3c 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -63,6 +63,7 @@ #include "nsIFrameManager.h" #include "nsISupportsPrimitives.h" #include "nsILayoutHistoryState.h" +#include "stopwatch.h" // Drag & Drop, Clipboard #include "nsWidgetsCID.h" @@ -177,7 +178,7 @@ public: NS_IMETHOD DoCopy(); NS_IMETHOD GetHistoryState(nsILayoutHistoryState** aLayoutHistoryState); - NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState); + NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState); //nsIViewObserver interface @@ -305,6 +306,12 @@ private: nsIFrame* GetCurrentEventFrame(); void PushCurrentEventFrame(); void PopCurrentEventFrame(); + +#ifdef RAPTOR_PERF_METRICS + Stopwatch mReflowWatch; // Used for measuring time spent in reflow + Stopwatch mFrameCreationWatch; // Used for measuring time spent in frame creation +#endif + }; #ifdef NS_DEBUG @@ -833,6 +840,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } if (nsnull != mRootFrame) { + NS_RESET_AND_START_STOPWATCH(mReflowWatch) // Kick off a top-down reflow NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight)); @@ -870,6 +878,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } NS_IF_RELEASE(rcx); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow")); + NS_STOP_STOPWATCH(mReflowWatch) } ExitReflowLock();