From afade16145a1f8dbf7f616fe0304f2eb80e9b1c5 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Fri, 24 Sep 1999 07:13:39 +0000 Subject: [PATCH] a=chofmann. Add a stopwatch to measure total (layout+page load) time in the webshell. git-svn-id: svn://10.0.0.236/trunk@48970 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 26 ++++++++++++++++++++++++++ mozilla/webshell/src/nsWebShell.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index db1c6d742c2..e1c11c259ea 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -66,6 +66,7 @@ #include "nsLayoutCID.h" #include "nsIDOMRange.h" #include "nsIFrameReflow.h" +#include "stopwatch.h" #include "nsILocaleService.h" static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID); @@ -485,6 +486,10 @@ protected: // if there is no mWindow, this will keep track of the bounds --dwc0001 nsRect mBounds; +#ifdef RAPTOR_PERF_METRICS + Stopwatch mTotalTime; +#endif + #ifdef DETECT_WEBSHELL_LEAKS private: // We're counting the number of |nsWebShells| to help find leaks @@ -2084,6 +2089,20 @@ nsWebShell::DoLoadURL(nsIURI * aUri, mProcessedEndDocumentLoad = PR_FALSE; +#ifdef RAPTOR_PERF_METRICS + { + char* url; + nsresult rv = NS_OK; + rv = aUri->GetSpec(&url); + if (NS_SUCCEEDED(rv)) { + printf("*** Timing layout processes on url: '%s'\n", url); + delete [] url; + } + } + + NS_RESET_AND_START_STOPWATCH(mTotalTime) +#endif + /* WebShell was primarily passing the buck when it came to streamObserver. * So, pass on the observer which is already a streamObserver to DocLoder. * - Radha @@ -3335,6 +3354,13 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader, nsresult aStatus, nsIDocumentLoaderObserver * aWebShell) { +#ifdef RAPTOR_PERF_METRICS + NS_STOP_STOPWATCH(mTotalTime) + printf("Total Layout+Load Time: "); + mTotalTime.Print(); + printf("\n"); +#endif + nsresult rv = NS_ERROR_FAILURE; if (!channel) { return NS_ERROR_NULL_POINTER; diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index db1c6d742c2..e1c11c259ea 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -66,6 +66,7 @@ #include "nsLayoutCID.h" #include "nsIDOMRange.h" #include "nsIFrameReflow.h" +#include "stopwatch.h" #include "nsILocaleService.h" static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID); @@ -485,6 +486,10 @@ protected: // if there is no mWindow, this will keep track of the bounds --dwc0001 nsRect mBounds; +#ifdef RAPTOR_PERF_METRICS + Stopwatch mTotalTime; +#endif + #ifdef DETECT_WEBSHELL_LEAKS private: // We're counting the number of |nsWebShells| to help find leaks @@ -2084,6 +2089,20 @@ nsWebShell::DoLoadURL(nsIURI * aUri, mProcessedEndDocumentLoad = PR_FALSE; +#ifdef RAPTOR_PERF_METRICS + { + char* url; + nsresult rv = NS_OK; + rv = aUri->GetSpec(&url); + if (NS_SUCCEEDED(rv)) { + printf("*** Timing layout processes on url: '%s'\n", url); + delete [] url; + } + } + + NS_RESET_AND_START_STOPWATCH(mTotalTime) +#endif + /* WebShell was primarily passing the buck when it came to streamObserver. * So, pass on the observer which is already a streamObserver to DocLoder. * - Radha @@ -3335,6 +3354,13 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader, nsresult aStatus, nsIDocumentLoaderObserver * aWebShell) { +#ifdef RAPTOR_PERF_METRICS + NS_STOP_STOPWATCH(mTotalTime) + printf("Total Layout+Load Time: "); + mTotalTime.Print(); + printf("\n"); +#endif + nsresult rv = NS_ERROR_FAILURE; if (!channel) { return NS_ERROR_NULL_POINTER;