зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1692934 - Record meta.contentEarliestTime in each process - r=canaltinova
This contentEarliestTime is the time when the earliest (and oldest) surviving chunk was prepared to start receiving data. It should be a good hint to the front-end about where the profiling data actually starts. Differential Revision: https://phabricator.services.mozilla.com/D151355
This commit is contained in:
Родитель
1bc597cb95
Коммит
29a5385f1e
|
@ -1859,6 +1859,18 @@ static void StreamMetaJSCustomObject(PSLockRef aLock,
|
|||
CorePS::ProcessStartTime())
|
||||
.ToMilliseconds());
|
||||
|
||||
if (const TimeStamp contentEarliestTime =
|
||||
ActivePS::Buffer(aLock)
|
||||
.UnderlyingChunkedBuffer()
|
||||
.GetEarliestChunkStartTimeStamp();
|
||||
!contentEarliestTime.IsNull()) {
|
||||
aWriter.DoubleProperty(
|
||||
"contentEarliestTime",
|
||||
(contentEarliestTime - CorePS::ProcessStartTime()).ToMilliseconds());
|
||||
} else {
|
||||
aWriter.NullProperty("contentEarliestTime");
|
||||
}
|
||||
|
||||
if (aIsShuttingDown) {
|
||||
aWriter.DoubleProperty("shutdownTime", profiler_time());
|
||||
} else {
|
||||
|
|
|
@ -161,6 +161,7 @@ class ProfileBufferChunk {
|
|||
#endif
|
||||
mInternalHeader.mHeader.mOffsetFirstBlock = aTailSize;
|
||||
mInternalHeader.mHeader.mOffsetPastLastBlock = aTailSize;
|
||||
mInternalHeader.mHeader.mStartTimeStamp = TimeStamp::Now();
|
||||
return SpanOfBytes(&mBuffer, aTailSize);
|
||||
}
|
||||
|
||||
|
@ -237,6 +238,7 @@ class ProfileBufferChunk {
|
|||
void Reset() {
|
||||
mOffsetFirstBlock = 0;
|
||||
mOffsetPastLastBlock = 0;
|
||||
mStartTimeStamp = TimeStamp{};
|
||||
mDoneTimeStamp = TimeStamp{};
|
||||
mBlockCount = 0;
|
||||
mRangeStart = 0;
|
||||
|
@ -255,7 +257,9 @@ class ProfileBufferChunk {
|
|||
// ProfileBufferChunk. It may be before mBufferBytes if ProfileBufferChunk
|
||||
// is marked "Done" before the end is reached.
|
||||
Length mOffsetPastLastBlock = 0;
|
||||
// Timestamp when buffer is "Done" (which happens when the last block is
|
||||
// Timestamp when the buffer becomes in-use, ready to record data.
|
||||
TimeStamp mStartTimeStamp;
|
||||
// Timestamp when the buffer is "Done" (which happens when the last block is
|
||||
// written). This will be used to find and discard the oldest
|
||||
// ProfileBufferChunk.
|
||||
TimeStamp mDoneTimeStamp;
|
||||
|
|
|
@ -254,6 +254,26 @@ class ProfileChunkedBuffer {
|
|||
mFailedPutBytes};
|
||||
}
|
||||
|
||||
// In in-session, return the start TimeStamp of the earliest chunk.
|
||||
// If out-of-session, return a null TimeStamp.
|
||||
[[nodiscard]] TimeStamp GetEarliestChunkStartTimeStamp() const {
|
||||
baseprofiler::detail::BaseProfilerMaybeAutoLock lock(mMutex);
|
||||
if (MOZ_UNLIKELY(!mChunkManager)) {
|
||||
// Out-of-session.
|
||||
return {};
|
||||
}
|
||||
return mChunkManager->PeekExtantReleasedChunks(
|
||||
[&](const ProfileBufferChunk* aOldestChunk) -> TimeStamp {
|
||||
if (aOldestChunk) {
|
||||
return aOldestChunk->ChunkHeader().mStartTimeStamp;
|
||||
}
|
||||
if (mCurrentChunk) {
|
||||
return mCurrentChunk->ChunkHeader().mStartTimeStamp;
|
||||
}
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsEmpty() const {
|
||||
baseprofiler::detail::BaseProfilerMaybeAutoLock lock(mMutex);
|
||||
return mRangeStart == mRangeEnd;
|
||||
|
|
|
@ -1312,6 +1312,7 @@ static void TestChunk() {
|
|||
sizeof(ProfileBufferChunk::Header) ==
|
||||
sizeof(ProfileBufferChunk::Header::mOffsetFirstBlock) +
|
||||
sizeof(ProfileBufferChunk::Header::mOffsetPastLastBlock) +
|
||||
sizeof(ProfileBufferChunk::Header::mStartTimeStamp) +
|
||||
sizeof(ProfileBufferChunk::Header::mDoneTimeStamp) +
|
||||
sizeof(ProfileBufferChunk::Header::mBufferBytes) +
|
||||
sizeof(ProfileBufferChunk::Header::mBlockCount) +
|
||||
|
|
|
@ -2793,6 +2793,18 @@ static void StreamMetaJSCustomObject(
|
|||
CorePS::ProcessStartTime())
|
||||
.ToMilliseconds());
|
||||
|
||||
if (const TimeStamp contentEarliestTime =
|
||||
ActivePS::Buffer(aLock)
|
||||
.UnderlyingChunkedBuffer()
|
||||
.GetEarliestChunkStartTimeStamp();
|
||||
!contentEarliestTime.IsNull()) {
|
||||
aWriter.DoubleProperty(
|
||||
"contentEarliestTime",
|
||||
(contentEarliestTime - CorePS::ProcessStartTime()).ToMilliseconds());
|
||||
} else {
|
||||
aWriter.NullProperty("contentEarliestTime");
|
||||
}
|
||||
|
||||
if (aIsShuttingDown) {
|
||||
aWriter.DoubleProperty("shutdownTime", profiler_time());
|
||||
} else {
|
||||
|
|
|
@ -1379,6 +1379,7 @@ static void JSONRootCheck(const Json::Value& aRoot,
|
|||
EXPECT_HAS_JSON(meta["version"], UInt);
|
||||
EXPECT_HAS_JSON(meta["startTime"], Double);
|
||||
EXPECT_HAS_JSON(meta["profilingStartTime"], Double);
|
||||
EXPECT_HAS_JSON(meta["contentEarliestTime"], Double);
|
||||
|
||||
EXPECT_HAS_JSON(aRoot["pages"], Array);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче