Bug 686435 - Add a telemetry probe on nsAppShellService::CreateTopLevelWindow. r=taras

This commit is contained in:
Mike Hommey 2011-09-23 14:30:49 +02:00
Родитель 26bc170067
Коммит 929d827c8b
3 изменённых файлов: 16 добавлений и 2 удалений

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

@ -100,6 +100,9 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
using namespace mozilla; using namespace mozilla;
extern PRTime gXRE_mainTimestamp; extern PRTime gXRE_mainTimestamp;
// The following tracks our overhead between reaching XRE_main and loading any XUL
extern PRTime gCreateTopLevelWindowTimestamp;// Timestamp of the first call to
// nsAppShellService::CreateTopLevelWindow
extern PRTime gFirstPaintTimestamp; extern PRTime gFirstPaintTimestamp;
// mfinklesessionstore-browser-state-restored might be a better choice than the one below // mfinklesessionstore-browser-state-restored might be a better choice than the one below
static PRTime gRestoredTimestamp = 0; // Timestamp of sessionstore-windows-restored static PRTime gRestoredTimestamp = 0; // Timestamp of sessionstore-windows-restored
@ -713,7 +716,8 @@ enum {
INVALID_PROCESS_CREATION = 0, INVALID_PROCESS_CREATION = 0,
INVALID_MAIN, INVALID_MAIN,
INVALID_FIRST_PAINT, INVALID_FIRST_PAINT,
INVALID_SESSION_RESTORED INVALID_SESSION_RESTORED,
INVALID_CREATE_TOP_LEVEL_WINDOW
}; };
NS_IMETHODIMP NS_IMETHODIMP
@ -763,6 +767,11 @@ nsAppStartup::GetStartupInfo()
else else
Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, INVALID_MAIN); Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, INVALID_MAIN);
if (gCreateTopLevelWindowTimestamp >= gProcessCreationTimestamp)
MaybeDefineProperty(cx, obj, "createTopLevelWindow", gCreateTopLevelWindowTimestamp);
else
Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, INVALID_CREATE_TOP_LEVEL_WINDOW);
if (gFirstPaintTimestamp >= gXRE_mainTimestamp) if (gFirstPaintTimestamp >= gXRE_mainTimestamp)
MaybeDefineProperty(cx, obj, "firstPaint", gFirstPaintTimestamp); MaybeDefineProperty(cx, obj, "firstPaint", gFirstPaintTimestamp);
else else

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

@ -174,7 +174,7 @@ HISTOGRAM(MOZ_SQLITE_PLACES_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)"
HISTOGRAM(MOZ_SQLITE_COOKIES_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)") HISTOGRAM(MOZ_SQLITE_COOKIES_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)") HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
HISTOGRAM(MOZ_SQLITE_OTHER_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)") HISTOGRAM(MOZ_SQLITE_OTHER_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
HISTOGRAM(STARTUP_MEASUREMENT_ERRORS, 1, 3, 4, LINEAR, "Flags errors in startup calculation()") HISTOGRAM(STARTUP_MEASUREMENT_ERRORS, 1, 4, 5, LINEAR, "Flags errors in startup calculation()")
HISTOGRAM(NETWORK_DISK_CACHE_OPEN, 1, 10000, 10, EXPONENTIAL, "Time spent opening disk cache (ms)") HISTOGRAM(NETWORK_DISK_CACHE_OPEN, 1, 10000, 10, EXPONENTIAL, "Time spent opening disk cache (ms)")
HISTOGRAM(NETWORK_DISK_CACHE_TRASHRENAME, 1, 10000, 10, EXPONENTIAL, "Time spent renaming bad Cache to Cache.Trash (ms)") HISTOGRAM(NETWORK_DISK_CACHE_TRASHRENAME, 1, 10000, 10, EXPONENTIAL, "Time spent renaming bad Cache to Cache.Trash (ms)")
HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR, 1, 10000, 10, EXPONENTIAL, "Time spent deleting disk cache (ms)") HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR, 1, 10000, 10, EXPONENTIAL, "Time spent deleting disk cache (ms)")

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

@ -156,6 +156,8 @@ nsAppShellService::DestroyHiddenWindow()
return NS_OK; return NS_OK;
} }
PRTime gCreateTopLevelWindowTimestamp = 0;
/* /*
* Create a new top level window and display the given URL within it... * Create a new top level window and display the given URL within it...
*/ */
@ -171,6 +173,9 @@ nsAppShellService::CreateTopLevelWindow(nsIXULWindow *aParent,
{ {
nsresult rv; nsresult rv;
if (!gCreateTopLevelWindowTimestamp)
gCreateTopLevelWindowTimestamp = PR_Now();
nsWebShellWindow *newWindow = nsnull; nsWebShellWindow *newWindow = nsnull;
rv = JustCreateTopWindow(aParent, aUrl, rv = JustCreateTopWindow(aParent, aUrl,
aChromeMask, aInitialWidth, aInitialHeight, aChromeMask, aInitialWidth, aInitialHeight,