This reverts commitd62c33a0e8. Revert "Bug1972836- Migrate main ping startup io figures r=TravisLong" This reverts commitb73a0d5f23. Revert "Bug1972836- Migrate failedProfileLockCount to Glean r=mossop,jhirsch,profiles-reviewers" This reverts commit835b6affbd. Revert "Bug1972836- Migrate AddonManager simpleMeasurements to Glean r=TravisLong" This reverts commit2bf4324c94. Revert "Bug1972836- Add global startup timeline instrumentation r=TravisLong,extension-reviewers,sessionstore-reviewers,firefox-desktop-core-reviewers ,sfoster,robwu" This reverts commit223c4696f1. Revert "Bug1972836- Migrate browser timeline probes to Glean r=TravisLong,firefox-desktop-core-reviewers" This reverts commit110be71b34. Revert "Bug1972836- Migrate sessionstore timeline probes to Glean r=TravisLong,sessionstore-reviewers,sfoster" This reverts commit432e582561. Revert "Bug1972836- Migrate extensions timeline probes to Glean r=TravisLong,robwu" This reverts commite1f34dcb09. Revert "Bug1972836- Migrate startup timeline to Glean r=TravisLong" This reverts commitb320f56f4d. Revert "Bug1972836- Migrate 'main' ping session info to Glean r=TravisLong" This reverts commita5fd38a201.
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
/* 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/. */
|
|
|
|
#include "StartupTimeline.h"
|
|
#include "mozilla/glean/StartupMetrics.h"
|
|
#include "mozilla/TimeStamp.h"
|
|
#include "nsXULAppAPI.h"
|
|
|
|
namespace mozilla {
|
|
|
|
TimeStamp StartupTimeline::sStartupTimeline[StartupTimeline::MAX_EVENT_ID];
|
|
const char*
|
|
StartupTimeline::sStartupTimelineDesc[StartupTimeline::MAX_EVENT_ID] = {
|
|
#define mozilla_StartupTimeline_Event(ev, desc) desc,
|
|
#include "StartupTimeline.h"
|
|
#undef mozilla_StartupTimeline_Event
|
|
};
|
|
|
|
} /* namespace mozilla */
|
|
|
|
using mozilla::StartupTimeline;
|
|
using mozilla::TimeStamp;
|
|
|
|
/**
|
|
* The XRE_StartupTimeline_Record function is to be used by embedding
|
|
* applications that can't use mozilla::StartupTimeline::Record() directly.
|
|
*
|
|
* @param aEvent The event to be recorded, must correspond to an element of the
|
|
* mozilla::StartupTimeline::Event enumartion
|
|
* @param aWhen The time at which the event happened
|
|
*/
|
|
void XRE_StartupTimelineRecord(int aEvent, TimeStamp aWhen) {
|
|
StartupTimeline::Record((StartupTimeline::Event)aEvent, aWhen);
|
|
}
|
|
|
|
void StartupTimeline::RecordOnce(Event ev) { RecordOnce(ev, TimeStamp::Now()); }
|
|
|
|
void StartupTimeline::RecordOnce(Event ev, const TimeStamp& aWhen) {
|
|
if (HasRecord(ev)) {
|
|
return;
|
|
}
|
|
|
|
Record(ev, aWhen);
|
|
|
|
// Record first paint timestamp as a scalar in the parent process.
|
|
if (!XRE_IsParentProcess()) {
|
|
return;
|
|
}
|
|
|
|
if (ev == FIRST_PAINT || ev == FIRST_PAINT2) {
|
|
uint32_t firstPaintTime =
|
|
(uint32_t)(aWhen - TimeStamp::ProcessCreation()).ToMilliseconds();
|
|
if (ev == FIRST_PAINT) {
|
|
glean::timestamps::first_paint.Set(firstPaintTime);
|
|
} else {
|
|
glean::timestamps::first_paint_two.Set(firstPaintTime);
|
|
}
|
|
}
|
|
}
|