/work/obj-fuzz/dist/include/mozilla/StartupTimeline.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | #ifdef mozilla_StartupTimeline_Event |
6 | | mozilla_StartupTimeline_Event(PROCESS_CREATION, "process") |
7 | | mozilla_StartupTimeline_Event(START, "start") |
8 | | mozilla_StartupTimeline_Event(MAIN, "main") |
9 | | mozilla_StartupTimeline_Event(SELECT_PROFILE, "selectProfile") |
10 | | mozilla_StartupTimeline_Event(AFTER_PROFILE_LOCKED, "afterProfileLocked") |
11 | | // Record the beginning and end of startup crash detection to compare with crash stats to know whether |
12 | | // detection should be improved to start or end sooner. |
13 | | mozilla_StartupTimeline_Event(STARTUP_CRASH_DETECTION_BEGIN, "startupCrashDetectionBegin") |
14 | | mozilla_StartupTimeline_Event(STARTUP_CRASH_DETECTION_END, "startupCrashDetectionEnd") |
15 | | mozilla_StartupTimeline_Event(FIRST_PAINT, "firstPaint") |
16 | | mozilla_StartupTimeline_Event(SESSION_RESTORE_INIT, "sessionRestoreInit") |
17 | | mozilla_StartupTimeline_Event(SESSION_RESTORED, "sessionRestored") |
18 | | mozilla_StartupTimeline_Event(CREATE_TOP_LEVEL_WINDOW, "createTopLevelWindow") |
19 | | mozilla_StartupTimeline_Event(LINKER_INITIALIZED, "linkerInitialized") |
20 | | mozilla_StartupTimeline_Event(LIBRARIES_LOADED, "librariesLoaded") |
21 | | mozilla_StartupTimeline_Event(FIRST_LOAD_URI, "firstLoadURI") |
22 | | |
23 | | // The following are actually shutdown events, used to monitor the duration of shutdown |
24 | | mozilla_StartupTimeline_Event(QUIT_APPLICATION, "quitApplication") |
25 | | mozilla_StartupTimeline_Event(PROFILE_BEFORE_CHANGE, "profileBeforeChange") |
26 | | #else |
27 | | |
28 | | #ifndef mozilla_StartupTimeline |
29 | | #define mozilla_StartupTimeline |
30 | | |
31 | | #include "mozilla/TimeStamp.h" |
32 | | #include "nscore.h" |
33 | | |
34 | | #ifdef MOZILLA_INTERNAL_API |
35 | | #include "GeckoProfiler.h" |
36 | | #endif |
37 | | |
38 | | namespace mozilla { |
39 | | |
40 | | void RecordShutdownEndTimeStamp(); |
41 | | void RecordShutdownStartTimeStamp(); |
42 | | |
43 | | class StartupTimeline { |
44 | | public: |
45 | | enum Event { |
46 | | #define mozilla_StartupTimeline_Event(ev, z) ev, |
47 | | #include "StartupTimeline.h" |
48 | | #undef mozilla_StartupTimeline_Event |
49 | | MAX_EVENT_ID |
50 | | }; |
51 | | |
52 | 0 | static TimeStamp Get(Event ev) { |
53 | 0 | return sStartupTimeline[ev]; |
54 | 0 | } |
55 | | |
56 | | static const char *Describe(Event ev) { |
57 | | return sStartupTimelineDesc[ev]; |
58 | | } |
59 | | |
60 | | #ifdef MOZILLA_INTERNAL_API |
61 | 3 | static void Record(Event ev) { |
62 | 3 | PROFILER_ADD_MARKER(Describe(ev)); |
63 | 3 | Record(ev, TimeStamp::Now()); |
64 | 3 | } |
65 | | |
66 | 6 | static void Record(Event ev, TimeStamp when) { |
67 | 6 | sStartupTimeline[ev] = when; |
68 | 6 | } |
69 | | |
70 | | static void RecordOnce(Event ev); |
71 | | #endif |
72 | | |
73 | 0 | static bool HasRecord(Event ev) { |
74 | 0 | return !sStartupTimeline[ev].IsNull(); |
75 | 0 | } |
76 | | |
77 | | private: |
78 | | static TimeStamp sStartupTimeline[MAX_EVENT_ID]; |
79 | | static const char* sStartupTimelineDesc[MAX_EVENT_ID]; |
80 | | }; |
81 | | |
82 | | } // namespace mozilla |
83 | | |
84 | | #endif /* mozilla_StartupTimeline */ |
85 | | |
86 | | #endif /* mozilla_StartupTimeline_Event */ |