зеркало из https://github.com/mozilla/pjs.git
Added code to measure document load times
This commit is contained in:
Родитель
5224fcd5f5
Коммит
502d3702ec
|
@ -1651,6 +1651,7 @@ nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadT
|
||||||
PRUint32 size;
|
PRUint32 size;
|
||||||
mStatus->SetText(url,size);
|
mStatus->SetText(url,size);
|
||||||
}
|
}
|
||||||
|
mLoadStartTime = PR_Now();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1679,6 +1680,17 @@ nsBrowserWindow::EndLoadURL(nsIWebShell* aShell,
|
||||||
const PRUnichar* aURL,
|
const PRUnichar* aURL,
|
||||||
PRInt32 aStatus)
|
PRInt32 aStatus)
|
||||||
{
|
{
|
||||||
|
PRTime endLoadTime = PR_Now();
|
||||||
|
if (mShowLoadTimes) {
|
||||||
|
nsAutoString msg(aURL);
|
||||||
|
printf("Loading ");
|
||||||
|
fputs(msg, stdout);
|
||||||
|
PRTime delta;
|
||||||
|
LL_SUB(delta, endLoadTime, mLoadStartTime);
|
||||||
|
double usecs;
|
||||||
|
LL_L2D(usecs, delta);
|
||||||
|
printf(" took %g milliseconds\n", usecs / 1000.0);
|
||||||
|
}
|
||||||
if (mThrobber) {
|
if (mThrobber) {
|
||||||
mThrobber->Stop();
|
mThrobber->Stop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
//#include "nsIPref.h"
|
#include "prtime.h"
|
||||||
|
|
||||||
#include "nsIXPBaseWindow.h"
|
#include "nsIXPBaseWindow.h"
|
||||||
#include "nsPrintSetupDialog.h"
|
#include "nsPrintSetupDialog.h"
|
||||||
|
@ -202,6 +202,10 @@ public:
|
||||||
|
|
||||||
static void CloseAllWindows();
|
static void CloseAllWindows();
|
||||||
|
|
||||||
|
void SetShowLoadTimes(PRBool aOn) {
|
||||||
|
mShowLoadTimes = aOn;
|
||||||
|
}
|
||||||
|
|
||||||
nsViewerApp* mApp;
|
nsViewerApp* mApp;
|
||||||
|
|
||||||
PRUint32 mChromeMask;
|
PRUint32 mChromeMask;
|
||||||
|
@ -212,6 +216,9 @@ public:
|
||||||
|
|
||||||
nsString mOpenFileDirectory;
|
nsString mOpenFileDirectory;
|
||||||
|
|
||||||
|
PRTime mLoadStartTime;
|
||||||
|
PRBool mShowLoadTimes;
|
||||||
|
|
||||||
// "Toolbar"
|
// "Toolbar"
|
||||||
nsITextWidget* mLocation;
|
nsITextWidget* mLocation;
|
||||||
nsIButton* mBack;
|
nsIButton* mBack;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче