Bug 1417976 - Part 3: Stream the DocShell list and DocShellId marker data to profile data r=mstange

MozReview-Commit-ID: G2s5H8i4p6E

Depends on D4915

Differential Revision: https://phabricator.services.mozilla.com/D4916

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nazım Can Altınova 2018-11-06 21:46:46 +00:00
Родитель f967885c60
Коммит 251628f687
4 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -25,6 +25,17 @@ return DocShellHistoryId() == aOtherPageInfo->DocShellHistoryId() &&
IsSubFrame() == aOtherPageInfo->IsSubFrame();
}
void
PageInformation::StreamJSON(SpliceableJSONWriter& aWriter)
{
aWriter.StartObjectElement();
aWriter.StringProperty("docshellId", nsIDToCString(DocShellId()).get());
aWriter.DoubleProperty("historyId", DocShellHistoryId());
aWriter.StringProperty("url", Url().get());
aWriter.BoolProperty("isSubFrame", IsSubFrame());
aWriter.EndObject();
}
size_t
PageInformation::SizeOfIncludingThis(
mozilla::MallocSizeOf aMallocSizeOf) const

Просмотреть файл

@ -30,6 +30,7 @@ public:
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
bool Equals(PageInformation* aOtherDocShellInfo);
void StreamJSON(SpliceableJSONWriter& aWriter);
uint32_t DocShellHistoryId() { return mDocShellHistoryId; }
const nsID& DocShellId() { return mDocShellId; }

Просмотреть файл

@ -43,6 +43,12 @@ ProfilerMarkerPayload::StreamCommonProps(const char* aMarkerType,
StreamType(aMarkerType, aWriter);
WriteTime(aWriter, aProcessStartTime, mStartTime, "startTime");
WriteTime(aWriter, aProcessStartTime, mEndTime, "endTime");
if (mDocShellId) {
aWriter.StringProperty("docShellId", nsIDToCString(*mDocShellId).get());
}
if (mDocShellHistoryId) {
aWriter.DoubleProperty("docshellHistoryId", mDocShellHistoryId.ref());
}
if (mStack) {
aWriter.StartObjectProperty("stack");
{

Просмотреть файл

@ -1890,6 +1890,16 @@ StreamMetaJSCustomObject(PSLockRef aLock, SpliceableJSONWriter& aWriter,
}
}
static void
StreamPages(PSLockRef aLock, SpliceableJSONWriter& aWriter)
{
MOZ_RELEASE_ASSERT(CorePS::Exists());
ActivePS::DiscardExpiredPages(aLock);
for (const auto& page : ActivePS::ProfiledPages(aLock)) {
page->StreamJSON(aWriter);
}
}
#if defined(GP_OS_android)
static UniquePtr<ProfileBuffer>
CollectJavaThreadProfileData()
@ -1966,6 +1976,13 @@ locked_profiler_stream_json_for_this_process(PSLockRef aLock,
}
aWriter.EndObject();
// Put page data
aWriter.StartArrayProperty("pages");
{
StreamPages(aLock, aWriter);
}
aWriter.EndArray();
buffer.StreamCountersToJSON(aWriter, CorePS::ProcessStartTime(), aSinceTime);
buffer.StreamMemoryToJSON(aWriter, CorePS::ProcessStartTime(), aSinceTime);