Bug 1417976 - Part 2: Include DocShell IDs to marker payloads r=mstange

MozReview-Commit-ID: AML1ESUnFlu

Depends on D4914

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nazım Can Altınova 2018-11-02 16:17:54 +00:00
Родитель 95f5ae9b3a
Коммит 8432e48060
14 изменённых файлов: 269 добавлений и 68 удалений

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

@ -13740,6 +13740,17 @@ nsDocShell::SetOriginAttributes(JS::Handle<JS::Value> aOriginAttributes,
return SetOriginAttributes(attrs);
}
NS_IMETHODIMP
nsDocShell::GetOSHEId(uint32_t* aSHEntryId)
{
if (mOSHE) {
mOSHE->GetID(aSHEntryId);
return NS_OK;
} else {
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
{

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

@ -1091,6 +1091,8 @@ interface nsIDocShell : nsIDocShellTreeItem
in string asyncCause);
[noscript,notxpcom,nostdcall] void notifyJSRunToCompletionStop();
[noscript] void GetOSHEId(out uint32_t aSHEntryId);
/**
* This attribute determines whether a document which is not about:blank has
* already be loaded by this docShell.

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

@ -102,14 +102,16 @@ void
nsDOMNavigationTiming::NotifyUnloadEventStart()
{
mUnloadStart = TimeStamp::Now();
PROFILER_TRACING("Navigation", "Unload", TRACING_INTERVAL_START);
PROFILER_TRACING_DOCSHELL(
"Navigation", "Unload", TRACING_INTERVAL_START, mDocShell);
}
void
nsDOMNavigationTiming::NotifyUnloadEventEnd()
{
mUnloadEnd = TimeStamp::Now();
PROFILER_TRACING("Navigation", "Unload", TRACING_INTERVAL_END);
PROFILER_TRACING_DOCSHELL(
"Navigation", "Unload", TRACING_INTERVAL_END, mDocShell);
}
void
@ -120,7 +122,8 @@ nsDOMNavigationTiming::NotifyLoadEventStart()
}
mLoadEventStart = TimeStamp::Now();
PROFILER_TRACING("Navigation", "Load", TRACING_INTERVAL_START);
PROFILER_TRACING_DOCSHELL(
"Navigation", "Load", TRACING_INTERVAL_START, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
TimeStamp now = TimeStamp::Now();
@ -151,7 +154,8 @@ nsDOMNavigationTiming::NotifyLoadEventEnd()
}
mLoadEventEnd = TimeStamp::Now();
PROFILER_TRACING("Navigation", "Load", TRACING_INTERVAL_END);
PROFILER_TRACING_DOCSHELL(
"Navigation", "Load", TRACING_INTERVAL_END, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_END_MS,
@ -215,7 +219,8 @@ nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI)
mLoadedURI = aURI;
mDOMContentLoadedEventStart = TimeStamp::Now();
PROFILER_TRACING("Navigation", "DOMContentLoaded", TRACING_INTERVAL_START);
PROFILER_TRACING_DOCSHELL(
"Navigation", "DOMContentLoaded", TRACING_INTERVAL_START, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
TimeStamp now = TimeStamp::Now();
@ -248,7 +253,8 @@ nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
mLoadedURI = aURI;
mDOMContentLoadedEventEnd = TimeStamp::Now();
PROFILER_TRACING("Navigation", "DOMContentLoaded", TRACING_INTERVAL_END);
PROFILER_TRACING_DOCSHELL(
"Navigation", "DOMContentLoaded", TRACING_INTERVAL_END, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_CONTENT_LOADED_END_MS,

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

@ -6,6 +6,7 @@
#include "nsPresContext.h"
#include "nsContentUtils.h"
#include "nsDocShell.h"
#include "nsError.h"
#include <new>
#include "nsIContent.h"
@ -1134,12 +1135,17 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"EventDispatcher::Dispatch", OTHER, typeStr);
nsCOMPtr<nsIDocShell> docShell;
docShell = nsContentUtils::GetDocShellForEventTarget(aEvent->mTarget);
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
profiler_add_marker(
"DOMEvent",
MakeUnique<DOMEventMarkerPayload>(typeStr,
aEvent->mTimeStamp,
"DOMEvent",
TRACING_INTERVAL_START));
TRACING_INTERVAL_START,
docShellId,
docShellHistoryId));
EventTargetChainItem::HandleEventTargetChain(chain, postVisitor,
aCallback, cd);
@ -1149,7 +1155,9 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
MakeUnique<DOMEventMarkerPayload>(typeStr,
aEvent->mTimeStamp,
"DOMEvent",
TRACING_INTERVAL_END));
TRACING_INTERVAL_END,
docShellId,
docShellHistoryId));
} else
#endif
{

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

@ -7,6 +7,7 @@
#include "Performance.h"
#include "GeckoProfiler.h"
#include "nsIDocShell.h"
#include "nsRFPService.h"
#include "PerformanceEntry.h"
#include "PerformanceMainThread.h"
@ -249,9 +250,14 @@ Performance::Mark(const nsAString& aName, ErrorResult& aRv)
#ifdef MOZ_GECKO_PROFILER
if (profiler_is_active()) {
nsCOMPtr<EventTarget> et = do_QueryInterface(GetOwner());
nsCOMPtr<nsIDocShell> docShell =
nsContentUtils::GetDocShellForEventTarget(et);
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
profiler_add_marker(
"UserTiming",
MakeUnique<UserTimingMarkerPayload>(aName, TimeStamp::Now()));
MakeUnique<UserTimingMarkerPayload>(
aName, TimeStamp::Now(), docShellId, docShellHistoryId));
}
#endif
}
@ -347,10 +353,18 @@ Performance::Measure(const nsAString& aName,
endMark.emplace(aEndMark.Value());
}
profiler_add_marker(
"UserTiming",
MakeUnique<UserTimingMarkerPayload>(aName, startMark, endMark,
startTimeStamp, endTimeStamp));
nsCOMPtr<EventTarget> et = do_QueryInterface(GetOwner());
nsCOMPtr<nsIDocShell> docShell =
nsContentUtils::GetDocShellForEventTarget(et);
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
profiler_add_marker("UserTiming",
MakeUnique<UserTimingMarkerPayload>(aName,
startMark,
endMark,
startTimeStamp,
endTimeStamp,
docShellId,
docShellHistoryId));
}
#endif
}

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

@ -18,10 +18,14 @@ namespace mozilla {
class MOZ_RAII AutoProfilerStyleMarker
{
public:
explicit AutoProfilerStyleMarker(UniqueProfilerBacktrace aCause)
explicit AutoProfilerStyleMarker(UniqueProfilerBacktrace aCause,
const Maybe<nsID>& aDocShellId,
const Maybe<uint32_t>& aDocShellHistoryId)
: mActive(profiler_is_active())
, mStartTime(TimeStamp::Now())
, mCause(std::move(aCause))
, mDocShellId(aDocShellId)
, mDocShellHistoryId(aDocShellHistoryId)
{
if (!mActive) {
return;
@ -38,15 +42,22 @@ public:
return;
}
ServoTraversalStatistics::sActive = false;
profiler_add_marker("Styles", MakeUnique<StyleMarkerPayload>(
mStartTime, TimeStamp::Now(), std::move(mCause),
ServoTraversalStatistics::sSingleton));
profiler_add_marker(
"Styles",
MakeUnique<StyleMarkerPayload>(mStartTime,
TimeStamp::Now(),
std::move(mCause),
ServoTraversalStatistics::sSingleton,
mDocShellId,
mDocShellHistoryId));
}
private:
bool mActive;
TimeStamp mStartTime;
UniqueProfilerBacktrace mCause;
Maybe<nsID> mDocShellId;
Maybe<uint32_t> mDocShellHistoryId;
};
} // namespace mozilla

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

@ -3850,7 +3850,8 @@ PresShell::ScheduleViewManagerFlush(PaintType aType)
void
nsIPresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent)
{
AUTO_PROFILER_TRACING("Paint", "DispatchSynthMouseMove");
AUTO_PROFILER_TRACING_DOCSHELL(
"Paint", "DispatchSynthMouseMove", mPresContext->GetDocShell());
nsEventStatus status = nsEventStatus_eIgnore;
nsView* targetView = nsView::GetViewFor(aEvent->mWidget);
if (!targetView)
@ -4320,7 +4321,10 @@ PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
if (MOZ_LIKELY(!mIsDestroying)) {
nsAutoScriptBlocker scriptBlocker;
#ifdef MOZ_GECKO_PROFILER
AutoProfilerStyleMarker tracingStyleFlush(std::move(mStyleCause));
nsCOMPtr<nsIDocShell> docShell = mPresContext->GetDocShell();
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
AutoProfilerStyleMarker tracingStyleFlush(
std::move(mStyleCause), docShellId, docShellHistoryId);
#endif
mPresContext->RestyleManager()->ProcessPendingRestyles();
@ -4343,7 +4347,10 @@ PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
if (MOZ_LIKELY(!mIsDestroying)) {
nsAutoScriptBlocker scriptBlocker;
#ifdef MOZ_GECKO_PROFILER
AutoProfilerStyleMarker tracingStyleFlush(std::move(mStyleCause));
nsCOMPtr<nsIDocShell> docShell = mPresContext->GetDocShell();
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
AutoProfilerStyleMarker tracingStyleFlush(
std::move(mStyleCause), docShellId, docShellHistoryId);
#endif
mPresContext->RestyleManager()->ProcessPendingRestyles();
@ -8952,8 +8959,12 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
}
#ifdef MOZ_GECKO_PROFILER
AutoProfilerTracing tracingLayoutFlush("Paint", "Reflow",
std::move(mReflowCause));
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
AutoProfilerTracing tracingLayoutFlush("Paint",
"Reflow",
std::move(mReflowCause),
docShellId,
docShellHistoryId);
mReflowCause = nullptr;
#endif

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

@ -1701,7 +1701,8 @@ nsRefreshDriver::RunFrameRequestCallbacks(TimeStamp aNowTime)
mFrameRequestCallbackDocs.Clear();
if (!frameRequestCallbacks.IsEmpty()) {
AUTO_PROFILER_TRACING("Paint", "Scripts");
AUTO_PROFILER_TRACING_DOCSHELL(
"Paint", "Scripts", GetDocShell(mPresContext));
for (const DocumentFrameCallbacks& docCallbacks : frameRequestCallbacks) {
// XXXbz Bug 863140: GetInnerWindow can return the outer
// window in some cases.

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

@ -5139,7 +5139,13 @@ ScrollFrameHelper::ScrollEndEvent::Run()
void
ScrollFrameHelper::FireScrollEvent()
{
AUTO_PROFILER_TRACING("Paint", "FireScrollEvent");
nsIContent* content = mOuter->GetContent();
nsPresContext* prescontext = mOuter->PresContext();
#ifdef MOZ_GECKO_PROFILER
nsCOMPtr<nsIDocShell> docShell = prescontext->GetDocShell();
AUTO_PROFILER_TRACING_DOCSHELL("Paint", "FireScrollEvent", docShell);
#endif
MOZ_ASSERT(mScrollEvent);
mScrollEvent->Revoke();
mScrollEvent = nullptr;
@ -5147,8 +5153,6 @@ ScrollFrameHelper::FireScrollEvent()
ActiveLayerTracker::SetCurrentScrollHandlerFrame(mOuter);
WidgetGUIEvent event(true, eScroll, nullptr);
nsEventStatus status = nsEventStatus_eIgnore;
nsIContent* content = mOuter->GetContent();
nsPresContext* prescontext = mOuter->PresContext();
// Fire viewport scroll events at the document (where they
// will bubble to the window)
mozilla::layers::ScrollLinkedEffectDetector detector(content->GetComposedDoc());

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

@ -2560,7 +2560,10 @@ nsDisplayList::BuildLayers(nsDisplayListBuilder* aBuilder,
RefPtr<ContainerLayer> root;
{
AUTO_PROFILER_TRACING("Paint", "LayerBuilding");
#ifdef MOZ_GECKO_PROFILER
nsCOMPtr<nsIDocShell> docShell = presContext->GetDocShell();
AUTO_PROFILER_TRACING_DOCSHELL("Paint", "LayerBuilding", docShell);
#endif
if (XRE_IsContentProcess() && gfxPrefs::AlwaysPaint()) {
FrameLayerBuilder::InvalidateAllLayers(aLayerManager);

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

@ -3825,8 +3825,11 @@ profiler_add_marker_for_thread(int aThreadId,
}
void
profiler_tracing(const char* aCategory, const char* aMarkerName,
TracingKind aKind)
profiler_tracing(const char* aCategory,
const char* aMarkerName,
TracingKind aKind,
const Maybe<nsID>& aDocShellId,
const Maybe<uint32_t>& aDocShellHistoryId)
{
MOZ_RELEASE_ASSERT(CorePS::Exists());
@ -3837,13 +3840,18 @@ profiler_tracing(const char* aCategory, const char* aMarkerName,
return;
}
auto payload = MakeUnique<TracingMarkerPayload>(aCategory, aKind);
auto payload = MakeUnique<TracingMarkerPayload>(
aCategory, aKind, aDocShellId, aDocShellHistoryId);
racy_profiler_add_marker(aMarkerName, std::move(payload));
}
void
profiler_tracing(const char* aCategory, const char* aMarkerName,
TracingKind aKind, UniqueProfilerBacktrace aCause)
profiler_tracing(const char* aCategory,
const char* aMarkerName,
TracingKind aKind,
UniqueProfilerBacktrace aCause,
const Maybe<nsID>& aDocShellId,
const Maybe<uint32_t>& aDocShellHistoryId)
{
MOZ_RELEASE_ASSERT(CorePS::Exists());
@ -3854,8 +3862,8 @@ profiler_tracing(const char* aCategory, const char* aMarkerName,
return;
}
auto payload =
MakeUnique<TracingMarkerPayload>(aCategory, aKind, std::move(aCause));
auto payload = MakeUnique<TracingMarkerPayload>(
aCategory, aKind, aDocShellId, aDocShellHistoryId, std::move(aCause));
racy_profiler_add_marker(aMarkerName, std::move(payload));
}

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

@ -50,8 +50,11 @@
#define PROFILER_ADD_MARKER(markerName)
#define PROFILER_ADD_NETWORK_MARKER(uri, pri, channel, type, start, end, count, timings, redirect)
#define DECLARE_DOCSHELL_AND_HISTORY_ID(docShell)
#define PROFILER_TRACING(category, markerName, kind)
#define PROFILER_TRACING_DOCSHELL(category, markerName, kind, docshell)
#define AUTO_PROFILER_TRACING(category, markerName)
#define AUTO_PROFILER_TRACING_DOCSHELL(category, markerName, docShell)
#else // !MOZ_GECKO_PROFILER
@ -613,18 +616,55 @@ enum TracingKind {
TRACING_INTERVAL_END,
};
// Helper macro to retrieve DocShellId and DocShellHistoryId from docShell
#define DECLARE_DOCSHELL_AND_HISTORY_ID(docShell) \
mozilla::Maybe<nsID> docShellId; \
mozilla::Maybe<uint32_t> docShellHistoryId; \
if (docShell) { \
docShellId = Some(docShell->HistoryID()); \
uint32_t id; \
nsresult rv = docShell->GetOSHEId(&id); \
if (NS_SUCCEEDED(rv)) { \
docShellHistoryId = Some(id); \
} else { \
docShellHistoryId = Nothing(); \
} \
} else { \
docShellId = Nothing(); \
docShellHistoryId = Nothing(); \
}
// Adds a tracing marker to the profile. A no-op if the profiler is inactive or
// in privacy mode.
#define PROFILER_TRACING(category, markerName, kind) \
#define PROFILER_TRACING(category, markerName, kind) \
profiler_tracing(category, markerName, kind)
void profiler_tracing(const char* aCategory, const char* aMarkerName,
TracingKind aKind);
void profiler_tracing(const char* aCategory, const char* aMarkerName,
TracingKind aKind, UniqueProfilerBacktrace aCause);
#define PROFILER_TRACING_DOCSHELL(category, markerName, kind, docShell) \
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
profiler_tracing(category, markerName, kind, docShellId, docShellHistoryId)
void
profiler_tracing(
const char* aCategory,
const char* aMarkerName,
TracingKind aKind,
const mozilla::Maybe<nsID>& aDocShellId = mozilla::Nothing(),
const mozilla::Maybe<uint32_t>& aDocShellHistoryId = mozilla::Nothing());
void
profiler_tracing(
const char* aCategory,
const char* aMarkerName,
TracingKind aKind,
UniqueProfilerBacktrace aCause,
const mozilla::Maybe<nsID>& aDocShellId = mozilla::Nothing(),
const mozilla::Maybe<uint32_t>& aDocShellHistoryId = mozilla::Nothing());
// Adds a START/END pair of tracing markers.
#define AUTO_PROFILER_TRACING(category, markerName) \
mozilla::AutoProfilerTracing PROFILER_RAII(category, markerName)
#define AUTO_PROFILER_TRACING(category, markerName) \
mozilla::AutoProfilerTracing PROFILER_RAII( \
category, markerName, mozilla::Nothing(), mozilla::Nothing())
#define AUTO_PROFILER_TRACING_DOCSHELL(category, markerName, docShell) \
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
mozilla::AutoProfilerTracing PROFILER_RAII( \
category, markerName, docShellId, docShellHistoryId)
//---------------------------------------------------------------------------
// Output profiles
@ -808,35 +848,59 @@ public:
class MOZ_RAII AutoProfilerTracing
{
public:
AutoProfilerTracing(const char* aCategory, const char* aMarkerName
AutoProfilerTracing(const char* aCategory,
const char* aMarkerName,
const mozilla::Maybe<nsID>& aDocShellId,
const mozilla::Maybe<uint32_t>& aDocShellHistoryId
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategory(aCategory)
, mMarkerName(aMarkerName)
, mDocShellId(aDocShellId)
, mDocShellHistoryId(aDocShellHistoryId)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_START);
profiler_tracing(mCategory,
mMarkerName,
TRACING_INTERVAL_START,
mDocShellId,
mDocShellHistoryId);
}
AutoProfilerTracing(const char* aCategory, const char* aMarkerName,
UniqueProfilerBacktrace aBacktrace
AutoProfilerTracing(const char* aCategory,
const char* aMarkerName,
UniqueProfilerBacktrace aBacktrace,
const mozilla::Maybe<nsID>& aDocShellId,
const mozilla::Maybe<uint32_t>& aDocShellHistoryId
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategory(aCategory)
, mMarkerName(aMarkerName)
, mDocShellId(aDocShellId)
, mDocShellHistoryId(aDocShellHistoryId)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_START,
std::move(aBacktrace));
profiler_tracing(mCategory,
mMarkerName,
TRACING_INTERVAL_START,
std::move(aBacktrace),
mDocShellId,
mDocShellHistoryId);
}
~AutoProfilerTracing()
{
profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_END);
profiler_tracing(mCategory,
mMarkerName,
TRACING_INTERVAL_END,
mDocShellId,
mDocShellHistoryId);
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mCategory;
const char* mMarkerName;
const mozilla::Maybe<nsID> mDocShellId;
const mozilla::Maybe<uint32_t> mDocShellHistoryId;
};
// Set MOZ_PROFILER_STARTUP* environment variables that will be inherited into

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

@ -38,16 +38,26 @@ class UniqueStacks;
class ProfilerMarkerPayload
{
public:
explicit ProfilerMarkerPayload(UniqueProfilerBacktrace aStack = nullptr)
explicit ProfilerMarkerPayload(
const mozilla::Maybe<nsID>& aDocShellId = mozilla::Nothing(),
const mozilla::Maybe<uint32_t>& aDocShellHistoryId = mozilla::Nothing(),
UniqueProfilerBacktrace aStack = nullptr)
: mStack(std::move(aStack))
, mDocShellId(aDocShellId)
, mDocShellHistoryId(aDocShellHistoryId)
{}
ProfilerMarkerPayload(const mozilla::TimeStamp& aStartTime,
const mozilla::TimeStamp& aEndTime,
UniqueProfilerBacktrace aStack = nullptr)
ProfilerMarkerPayload(
const mozilla::TimeStamp& aStartTime,
const mozilla::TimeStamp& aEndTime,
const mozilla::Maybe<nsID>& aDocShellId = mozilla::Nothing(),
const mozilla::Maybe<uint32_t>& aDocShellHistoryId = mozilla::Nothing(),
UniqueProfilerBacktrace aStack = nullptr)
: mStartTime(aStartTime)
, mEndTime(aEndTime)
, mStack(std::move(aStack))
, mDocShellId(aDocShellId)
, mDocShellHistoryId(aDocShellHistoryId)
{}
virtual ~ProfilerMarkerPayload() {}
@ -70,10 +80,22 @@ protected:
mStack = std::move(aStack);
}
void SetDocShellHistoryId(const mozilla::Maybe<uint32_t>& aDocShellHistoryId)
{
mDocShellHistoryId = aDocShellHistoryId;
}
void SetDocShellId(const mozilla::Maybe<nsID>& aDocShellId)
{
mDocShellId = aDocShellId;
}
private:
mozilla::TimeStamp mStartTime;
mozilla::TimeStamp mEndTime;
UniqueProfilerBacktrace mStack;
mozilla::Maybe<nsID> mDocShellId;
mozilla::Maybe<uint32_t> mDocShellHistoryId;
};
#define DECL_STREAM_PAYLOAD \
@ -81,17 +103,24 @@ private:
const mozilla::TimeStamp& aProcessStartTime, \
UniqueStacks& aUniqueStacks) override;
// TODO: Increase the coverage of tracing markers that include DocShell information
class TracingMarkerPayload : public ProfilerMarkerPayload
{
public:
TracingMarkerPayload(const char* aCategory, TracingKind aKind,
UniqueProfilerBacktrace aCause = nullptr)
TracingMarkerPayload(
const char* aCategory,
TracingKind aKind,
const mozilla::Maybe<nsID>& aDocShellId = mozilla::Nothing(),
const mozilla::Maybe<uint32_t>& aDocShellHistoryId = mozilla::Nothing(),
UniqueProfilerBacktrace aCause = nullptr)
: mCategory(aCategory)
, mKind(aKind)
{
if (aCause) {
SetStack(std::move(aCause));
}
SetDocShellId(aDocShellId);
SetDocShellHistoryId(aDocShellHistoryId);
}
DECL_STREAM_PAYLOAD
@ -104,11 +133,16 @@ private:
class IOMarkerPayload : public ProfilerMarkerPayload
{
public:
IOMarkerPayload(const char* aSource, const char* aFilename,
IOMarkerPayload(const char* aSource,
const char* aFilename,
const mozilla::TimeStamp& aStartTime,
const mozilla::TimeStamp& aEndTime,
UniqueProfilerBacktrace aStack)
: ProfilerMarkerPayload(aStartTime, aEndTime, std::move(aStack))
: ProfilerMarkerPayload(aStartTime,
aEndTime,
mozilla::Nothing(),
mozilla::Nothing(),
std::move(aStack))
, mSource(aSource)
, mFilename(aFilename ? strdup(aFilename) : nullptr)
{
@ -127,8 +161,11 @@ class DOMEventMarkerPayload : public TracingMarkerPayload
public:
DOMEventMarkerPayload(const nsAString& aEventType,
const mozilla::TimeStamp& aTimeStamp,
const char* aCategory, TracingKind aKind)
: TracingMarkerPayload(aCategory, aKind)
const char* aCategory,
TracingKind aKind,
const mozilla::Maybe<nsID>& aDocShellId,
const mozilla::Maybe<uint32_t>& aDocShellHistoryId)
: TracingMarkerPayload(aCategory, aKind, aDocShellId, aDocShellHistoryId)
, mTimeStamp(aTimeStamp)
, mEventType(aEventType)
{}
@ -144,8 +181,13 @@ class UserTimingMarkerPayload : public ProfilerMarkerPayload
{
public:
UserTimingMarkerPayload(const nsAString& aName,
const mozilla::TimeStamp& aStartTime)
: ProfilerMarkerPayload(aStartTime, aStartTime)
const mozilla::TimeStamp& aStartTime,
const mozilla::Maybe<nsID>& aDocShellId,
const mozilla::Maybe<uint32_t>& aDocShellHistoryId)
: ProfilerMarkerPayload(aStartTime,
aStartTime,
aDocShellId,
aDocShellHistoryId)
, mEntryType("mark")
, mName(aName)
{}
@ -154,8 +196,13 @@ public:
const mozilla::Maybe<nsString>& aStartMark,
const mozilla::Maybe<nsString>& aEndMark,
const mozilla::TimeStamp& aStartTime,
const mozilla::TimeStamp& aEndTime)
: ProfilerMarkerPayload(aStartTime, aEndTime)
const mozilla::TimeStamp& aEndTime,
const mozilla::Maybe<nsID>& aDocShellId,
const mozilla::Maybe<uint32_t>& aDocShellHistoryId)
: ProfilerMarkerPayload(aStartTime,
aEndTime,
aDocShellId,
aDocShellHistoryId)
, mEntryType("measure")
, mName(aName)
, mStartMark(aStartMark)
@ -208,7 +255,8 @@ public:
class NetworkMarkerPayload : public ProfilerMarkerPayload
{
public:
NetworkMarkerPayload(int64_t aID, const char* aURI,
NetworkMarkerPayload(int64_t aID,
const char* aURI,
NetworkLoadType aType,
const mozilla::TimeStamp& aStartTime,
const mozilla::TimeStamp& aEndTime,
@ -216,10 +264,12 @@ public:
int64_t aCount,
const mozilla::net::TimingStruct* aTimings = nullptr,
const char* aRedirectURI = nullptr)
: ProfilerMarkerPayload(aStartTime, aEndTime)
: ProfilerMarkerPayload(aStartTime, aEndTime, mozilla::Nothing())
, mID(aID)
, mURI(aURI ? strdup(aURI) : nullptr)
, mRedirectURI(aRedirectURI && (strlen(aRedirectURI) > 0) ? strdup(aRedirectURI) : nullptr)
, mRedirectURI(aRedirectURI && (strlen(aRedirectURI) > 0)
? strdup(aRedirectURI)
: nullptr)
, mType(aType)
, mPri(aPri)
, mCount(aCount)
@ -328,8 +378,13 @@ public:
StyleMarkerPayload(const mozilla::TimeStamp& aStartTime,
const mozilla::TimeStamp& aEndTime,
UniqueProfilerBacktrace aCause,
const mozilla::ServoTraversalStatistics& aStats)
: ProfilerMarkerPayload(aStartTime, aEndTime)
const mozilla::ServoTraversalStatistics& aStats,
const mozilla::Maybe<nsID>& aDocShellId,
const mozilla::Maybe<uint32_t>& aDocShellHistoryId)
: ProfilerMarkerPayload(aStartTime,
aEndTime,
aDocShellId,
aDocShellHistoryId)
, mStats(aStats)
{
if (aCause) {

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

@ -458,7 +458,10 @@ TEST(GeckoProfiler, Markers)
PROFILER_ADD_MARKER("M3");
profiler_add_marker(
"M4",
MakeUnique<TracingMarkerPayload>("C", TRACING_EVENT,
MakeUnique<TracingMarkerPayload>("C",
TRACING_EVENT,
mozilla::Nothing(),
mozilla::Nothing(),
profiler_get_backtrace()));
for (int i = 0; i < 10; i++) {