Added code to measure document load times

This commit is contained in:
kipp%netscape.com 1999-04-23 19:48:05 +00:00
Родитель 5224fcd5f5
Коммит 502d3702ec
2 изменённых файлов: 20 добавлений и 1 удалений

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

@ -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;