2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-11-18 11:54:27 +04:00
|
|
|
|
|
|
|
#ifdef mozilla_StartupTimeline_Event
|
|
|
|
mozilla_StartupTimeline_Event(PROCESS_CREATION, "process")
|
2012-06-15 10:23:08 +04:00
|
|
|
mozilla_StartupTimeline_Event(START, "start")
|
2011-11-18 11:54:27 +04:00
|
|
|
mozilla_StartupTimeline_Event(MAIN, "main")
|
2013-10-09 18:38:35 +04:00
|
|
|
mozilla_StartupTimeline_Event(SELECT_PROFILE, "selectProfile")
|
|
|
|
mozilla_StartupTimeline_Event(AFTER_PROFILE_LOCKED, "afterProfileLocked")
|
2012-02-10 03:49:33 +04:00
|
|
|
// 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.
|
|
|
|
mozilla_StartupTimeline_Event(STARTUP_CRASH_DETECTION_BEGIN, "startupCrashDetectionBegin")
|
|
|
|
mozilla_StartupTimeline_Event(STARTUP_CRASH_DETECTION_END, "startupCrashDetectionEnd")
|
2011-11-18 11:54:27 +04:00
|
|
|
mozilla_StartupTimeline_Event(FIRST_PAINT, "firstPaint")
|
2014-04-04 16:34:24 +04:00
|
|
|
mozilla_StartupTimeline_Event(SESSION_RESTORE_INIT, "sessionRestoreInit")
|
2011-11-18 11:54:27 +04:00
|
|
|
mozilla_StartupTimeline_Event(SESSION_RESTORED, "sessionRestored")
|
|
|
|
mozilla_StartupTimeline_Event(CREATE_TOP_LEVEL_WINDOW, "createTopLevelWindow")
|
2011-11-18 11:54:37 +04:00
|
|
|
mozilla_StartupTimeline_Event(LINKER_INITIALIZED, "linkerInitialized")
|
|
|
|
mozilla_StartupTimeline_Event(LIBRARIES_LOADED, "librariesLoaded")
|
2012-01-19 11:40:18 +04:00
|
|
|
mozilla_StartupTimeline_Event(FIRST_LOAD_URI, "firstLoadURI")
|
2014-08-22 09:27:00 +04:00
|
|
|
|
|
|
|
// The following are actually shutdown events, used to monitor the duration of shutdown
|
|
|
|
mozilla_StartupTimeline_Event(QUIT_APPLICATION, "quitApplication")
|
|
|
|
mozilla_StartupTimeline_Event(PROFILE_BEFORE_CHANGE, "profileBeforeChange")
|
2011-11-18 11:54:27 +04:00
|
|
|
#else
|
|
|
|
|
|
|
|
#ifndef mozilla_StartupTimeline
|
|
|
|
#define mozilla_StartupTimeline
|
|
|
|
|
2013-03-28 14:50:16 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2011-11-18 11:54:27 +04:00
|
|
|
#include "nscore.h"
|
2017-02-27 21:39:34 +03:00
|
|
|
|
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2013-03-18 18:25:50 +04:00
|
|
|
#include "GeckoProfiler.h"
|
2017-02-27 21:39:34 +03:00
|
|
|
#endif
|
2011-11-18 11:54:27 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2012-07-07 02:29:53 +04:00
|
|
|
void RecordShutdownEndTimeStamp();
|
2012-12-13 21:06:27 +04:00
|
|
|
void RecordShutdownStartTimeStamp();
|
2012-07-07 02:29:53 +04:00
|
|
|
|
2011-11-18 11:54:27 +04:00
|
|
|
class StartupTimeline {
|
|
|
|
public:
|
|
|
|
enum Event {
|
|
|
|
#define mozilla_StartupTimeline_Event(ev, z) ev,
|
2011-12-09 00:43:05 +04:00
|
|
|
#include "StartupTimeline.h"
|
2011-11-18 11:54:27 +04:00
|
|
|
#undef mozilla_StartupTimeline_Event
|
|
|
|
MAX_EVENT_ID
|
|
|
|
};
|
|
|
|
|
2013-03-28 14:50:16 +04:00
|
|
|
static TimeStamp Get(Event ev) {
|
2011-11-18 11:54:27 +04:00
|
|
|
return sStartupTimeline[ev];
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *Describe(Event ev) {
|
|
|
|
return sStartupTimelineDesc[ev];
|
|
|
|
}
|
|
|
|
|
2017-02-27 21:39:34 +03:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2012-11-15 22:24:35 +04:00
|
|
|
static void Record(Event ev) {
|
2017-10-04 01:11:18 +03:00
|
|
|
PROFILER_ADD_MARKER(Describe(ev));
|
2013-03-28 14:50:16 +04:00
|
|
|
Record(ev, TimeStamp::Now());
|
2012-11-15 22:24:35 +04:00
|
|
|
}
|
|
|
|
|
2013-03-28 14:50:16 +04:00
|
|
|
static void Record(Event ev, TimeStamp when) {
|
2011-11-18 11:54:27 +04:00
|
|
|
sStartupTimeline[ev] = when;
|
|
|
|
}
|
|
|
|
|
2017-08-22 18:01:00 +03:00
|
|
|
static void RecordOnce(Event ev);
|
2017-02-27 21:39:34 +03:00
|
|
|
#endif
|
2012-01-19 11:40:18 +04:00
|
|
|
|
|
|
|
static bool HasRecord(Event ev) {
|
2013-03-28 14:50:16 +04:00
|
|
|
return !sStartupTimeline[ev].IsNull();
|
2011-11-18 11:54:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2017-04-03 23:02:31 +03:00
|
|
|
static TimeStamp sStartupTimeline[MAX_EVENT_ID];
|
|
|
|
static const char* sStartupTimelineDesc[MAX_EVENT_ID];
|
2011-11-18 11:54:27 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2011-11-18 11:54:27 +04:00
|
|
|
|
|
|
|
#endif /* mozilla_StartupTimeline */
|
|
|
|
|
|
|
|
#endif /* mozilla_StartupTimeline_Event */
|