зеркало из https://github.com/mozilla/gecko-dev.git
Bug 764021 - Add Startup Timeline probe for when entering main(). r=taras,r=bsmedberg
This commit is contained in:
Родитель
45feb6b7c3
Коммит
c94455deff
|
@ -90,6 +90,7 @@ XRE_FreeAppDataType XRE_FreeAppData;
|
|||
XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
|
||||
#endif
|
||||
XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
|
||||
XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
|
||||
XRE_mainType XRE_main;
|
||||
|
||||
static const nsDynamicFunctionLoad kXULFuncs[] = {
|
||||
|
@ -100,6 +101,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
|
|||
{ "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
|
||||
#endif
|
||||
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
|
||||
{ "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
|
||||
{ "XRE_main", (NSFuncPtr*) &XRE_main },
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
@ -189,8 +191,31 @@ bool IsPrefetchDisabledViaService()
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Local implementation of PR_Now, since the executable can't depend on NSPR */
|
||||
static PRTime _PR_Now()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
MOZ_STATIC_ASSERT(sizeof(PRTime) == sizeof(FILETIME), "PRTime must have the same size as FILETIME");
|
||||
FILETIME ft;
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
PRTime now;
|
||||
CopyMemory(&now, &ft, sizeof(PRTime));
|
||||
#ifdef __GNUC__
|
||||
return (now - 116444736000000000LL) / 10LL;
|
||||
#else
|
||||
return (now - 116444736000000000i64) / 10i64;
|
||||
#endif
|
||||
|
||||
#else
|
||||
struct timeval tm;
|
||||
gettimeofday(&tm, 0);
|
||||
return (((PRTime)tm.tv_sec * 1000000LL) + (PRTime)tm.tv_usec);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
PRTime start = _PR_Now();
|
||||
char exePath[MAXPATHLEN];
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -247,6 +272,8 @@ int main(int argc, char* argv[])
|
|||
return 255;
|
||||
}
|
||||
|
||||
XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start);
|
||||
|
||||
#ifdef XRE_HAS_DLL_BLOCKLIST
|
||||
XRE_SetupDllBlocklist();
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "StartupTimeline.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -13,4 +14,15 @@ const char *StartupTimeline::sStartupTimelineDesc[StartupTimeline::MAX_EVENT_ID]
|
|||
#undef mozilla_StartupTimeline_Event
|
||||
};
|
||||
|
||||
} /* namespace mozilla */
|
||||
|
||||
/**
|
||||
* The XRE_StartupTimeline_Record function is to be used by embedding applications
|
||||
* that can't use mozilla::StartupTimeline::Record() directly.
|
||||
*/
|
||||
void
|
||||
XRE_StartupTimelineRecord(int aEvent, PRTime aWhen)
|
||||
{
|
||||
mozilla::StartupTimeline::Record((mozilla::StartupTimeline::Event) aEvent, aWhen);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#ifdef mozilla_StartupTimeline_Event
|
||||
mozilla_StartupTimeline_Event(PROCESS_CREATION, "process")
|
||||
mozilla_StartupTimeline_Event(START, "start")
|
||||
mozilla_StartupTimeline_Event(MAIN, "main")
|
||||
// Record the beginning and end of startup crash detection to compare with crash stats to know whether
|
||||
// detection should be improved to start or end sooner.
|
||||
|
|
|
@ -439,6 +439,9 @@ XRE_API(void,
|
|||
XRE_API(void,
|
||||
XRE_TelemetryAccumulate, (int aID, PRUint32 aSample))
|
||||
|
||||
XRE_API(void,
|
||||
XRE_StartupTimelineRecord, (int aEvent, PRTime aWhen))
|
||||
|
||||
XRE_API(void,
|
||||
XRE_InitOmnijar, (nsIFile* greOmni,
|
||||
nsIFile* appOmni))
|
||||
|
|
Загрузка…
Ссылка в новой задаче