зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576819 - Use PROFILER_ADD_MARKER{,_WITH_PAYLOAD} everywhere - r=gregtatum
All calls to `profiler_add_marker()` (outside of the profilers code) are now replaced by either: - `PROFILER_ADD_MARKER(name, categoryPair)` - `PROFILER_ADD_MARKER_WITH_PAYLOAD(name, categoryPair, TypeOfMarkerPayload, (payload, ..., arguments))` This makes all calls consistent, and they won't need to prefix the category pair with `JS::ProfilingCategoryPair::`. Also it will make it easier to add (and later remove) internal-profiling instrumentation (bug 1576550), and to replace heap-allocated payloads with stack-allocated ones (bug 1576555). Differential Revision: https://phabricator.services.mozilla.com/D43588 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fdea67edb5
Коммит
95f77c2409
|
@ -839,7 +839,7 @@ nsresult Accessible::HandleAccEvent(AccEvent* aEvent) {
|
|||
nsAutoCString strMarker;
|
||||
strMarker.AppendLiteral("A11y Event - ");
|
||||
strMarker.Append(strEventType);
|
||||
profiler_add_marker(strMarker.get(), JS::ProfilingCategoryPair::OTHER);
|
||||
PROFILER_ADD_MARKER(strMarker.get(), OTHER);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -155,11 +155,9 @@ void TimeoutManager::MoveIdleToActive() {
|
|||
int(elapsed.ToMilliseconds()), int(target.ToMilliseconds()),
|
||||
int(delta.ToMilliseconds()));
|
||||
// don't have end before start...
|
||||
profiler_add_marker(
|
||||
"setTimeout deferred release", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<TextMarkerPayload>(
|
||||
marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now,
|
||||
now));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"setTimeout deferred release", DOM, TextMarkerPayload,
|
||||
(marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now, now));
|
||||
}
|
||||
#endif
|
||||
num++;
|
||||
|
@ -906,11 +904,10 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
|
|||
int(elapsed.ToMilliseconds()), int(target.ToMilliseconds()),
|
||||
int(delta.ToMilliseconds()), int(runtime.ToMilliseconds()));
|
||||
// don't have end before start...
|
||||
profiler_add_marker(
|
||||
"setTimeout", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<TextMarkerPayload>(
|
||||
marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now,
|
||||
now));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"setTimeout", DOM, TextMarkerPayload,
|
||||
(marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now,
|
||||
now));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -165,9 +165,8 @@ void nsDOMNavigationTiming::NotifyLoadEventEnd() {
|
|||
int(elapsed.ToMilliseconds()), int(duration.ToMilliseconds()));
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
|
||||
PAGELOAD_LOG(("%s", marker.get()));
|
||||
profiler_add_marker(
|
||||
"DocumentLoad", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<TextMarkerPayload>(marker, mNavigationStart, mLoadEventEnd,
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("DocumentLoad", DOM, TextMarkerPayload,
|
||||
(marker, mNavigationStart, mLoadEventEnd,
|
||||
docShellId, docShellHistoryId));
|
||||
}
|
||||
#endif
|
||||
|
@ -360,10 +359,9 @@ void nsDOMNavigationTiming::TTITimeout(nsITimer* aTimer) {
|
|||
int(elapsedLongTask.ToMilliseconds()), spec.get());
|
||||
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
|
||||
profiler_add_marker(
|
||||
"TTFI", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<TextMarkerPayload>(marker, mNavigationStart, mTTFI,
|
||||
docShellId, docShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"TTFI", DOM, TextMarkerPayload,
|
||||
(marker, mNavigationStart, mTTFI, docShellId, docShellHistoryId));
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
@ -395,9 +393,9 @@ void nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument() {
|
|||
"and first non-blank paint");
|
||||
PAGELOAD_LOG(("%s", marker.get()));
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
|
||||
profiler_add_marker(
|
||||
"FirstNonBlankPaint", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<TextMarkerPayload>(marker, mNavigationStart, mNonBlankPaint,
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("FirstNonBlankPaint", DOM,
|
||||
TextMarkerPayload,
|
||||
(marker, mNavigationStart, mNonBlankPaint,
|
||||
docShellId, docShellHistoryId));
|
||||
}
|
||||
#endif
|
||||
|
@ -445,10 +443,10 @@ void nsDOMNavigationTiming::NotifyContentfulPaintForRootContentDocument(
|
|||
"and first non-blank paint");
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
|
||||
PAGELOAD_LOG(("%s", marker.get()));
|
||||
profiler_add_marker("FirstContentfulPaint", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<TextMarkerPayload>(
|
||||
marker, mNavigationStart, mContentfulPaint,
|
||||
docShellId, docShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"FirstContentfulPaint", DOM, TextMarkerPayload,
|
||||
(marker, mNavigationStart, mContentfulPaint, docShellId,
|
||||
docShellHistoryId));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -495,10 +493,10 @@ void nsDOMNavigationTiming::NotifyDOMContentFlushedForRootContentDocument() {
|
|||
"and DOMContentFlushed");
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
|
||||
PAGELOAD_LOG(("%s", marker.get()));
|
||||
profiler_add_marker("DOMContentFlushed", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<TextMarkerPayload>(
|
||||
marker, mNavigationStart, mDOMContentFlushed,
|
||||
docShellId, docShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"DOMContentFlushed", DOM, TextMarkerPayload,
|
||||
(marker, mNavigationStart, mDOMContentFlushed, docShellId,
|
||||
docShellHistoryId));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1027,20 +1027,18 @@ nsresult EventDispatcher::Dispatch(nsISupports* aTarget,
|
|||
nsCOMPtr<nsIDocShell> docShell;
|
||||
docShell = nsContentUtils::GetDocShellForEventTarget(aEvent->mTarget);
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
|
||||
profiler_add_marker(
|
||||
"DOMEvent", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<DOMEventMarkerPayload>(
|
||||
typeStr, aEvent->mTimeStamp, "DOMEvent",
|
||||
TRACING_INTERVAL_START, docShellId, docShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"DOMEvent", DOM, DOMEventMarkerPayload,
|
||||
(typeStr, aEvent->mTimeStamp, "DOMEvent", TRACING_INTERVAL_START,
|
||||
docShellId, docShellHistoryId));
|
||||
|
||||
EventTargetChainItem::HandleEventTargetChain(chain, postVisitor,
|
||||
aCallback, cd);
|
||||
|
||||
profiler_add_marker(
|
||||
"DOMEvent", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<DOMEventMarkerPayload>(
|
||||
typeStr, aEvent->mTimeStamp, "DOMEvent", TRACING_INTERVAL_END,
|
||||
docShellId, docShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"DOMEvent", DOM, DOMEventMarkerPayload,
|
||||
(typeStr, aEvent->mTimeStamp, "DOMEvent", TRACING_INTERVAL_END,
|
||||
docShellId, docShellHistoryId));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
|
|
@ -36,13 +36,13 @@ extern LazyLogModule gMediaDecoderLog;
|
|||
MOZ_LOG(gMediaDecoderLog, LogLevel::Verbose, (FMT(x, ##__VA_ARGS__)))
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
# define VSINK_ADD_PROFILER_MARKER(tag, markerTime, aTime, vTime) \
|
||||
do { \
|
||||
if (profiler_thread_is_being_profiled()) { \
|
||||
profiler_add_marker( \
|
||||
tag, JS::ProfilingCategoryPair::GRAPHICS, \
|
||||
MakeUnique<VideoFrameMarkerPayload>(markerTime, aTime, vTime)); \
|
||||
} \
|
||||
# define VSINK_ADD_PROFILER_MARKER(tag, markerTime, aTime, vTime) \
|
||||
do { \
|
||||
if (profiler_thread_is_being_profiled()) { \
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(tag, GRAPHICS, \
|
||||
VideoFrameMarkerPayload, \
|
||||
(markerTime, aTime, vTime)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
class VideoFrameMarkerPayload : public ProfilerMarkerPayload {
|
||||
|
|
|
@ -226,10 +226,9 @@ void Performance::Mark(const nsAString& aName, ErrorResult& aRv) {
|
|||
nsCOMPtr<nsIDocShell> docShell =
|
||||
nsContentUtils::GetDocShellForEventTarget(et);
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
|
||||
profiler_add_marker(
|
||||
"UserTiming", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<UserTimingMarkerPayload>(aName, TimeStamp::Now(), docShellId,
|
||||
docShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"UserTiming", DOM, UserTimingMarkerPayload,
|
||||
(aName, TimeStamp::Now(), docShellId, docShellHistoryId));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -327,10 +326,10 @@ void Performance::Measure(const nsAString& aName,
|
|||
nsCOMPtr<nsIDocShell> docShell =
|
||||
nsContentUtils::GetDocShellForEventTarget(et);
|
||||
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
|
||||
profiler_add_marker("UserTiming", JS::ProfilingCategoryPair::DOM,
|
||||
MakeUnique<UserTimingMarkerPayload>(
|
||||
aName, startMark, endMark, startTimeStamp,
|
||||
endTimeStamp, docShellId, docShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"UserTiming", DOM, UserTimingMarkerPayload,
|
||||
(aName, startMark, endMark, startTimeStamp, endTimeStamp, docShellId,
|
||||
docShellHistoryId));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -2324,7 +2324,7 @@ void RecordCompositionPayloadsPresented(
|
|||
"Payload Presented, type: %d latency: %dms\n",
|
||||
int32_t(payload.mType),
|
||||
int32_t((presented - payload.mTimeStamp).ToMilliseconds()));
|
||||
profiler_add_marker(marker.get(), JS::ProfilingCategoryPair::GRAPHICS);
|
||||
PROFILER_ADD_MARKER(marker.get(), GRAPHICS);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ void CompositorScreenshotGrabber::MaybeProcessQueue() {
|
|||
|
||||
void CompositorScreenshotGrabber::NotifyEmptyFrame() {
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
profiler_add_marker("NoCompositorScreenshot because nothing changed",
|
||||
JS::ProfilingCategoryPair::GRAPHICS);
|
||||
PROFILER_ADD_MARKER("NoCompositorScreenshot because nothing changed",
|
||||
GRAPHICS);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -102,9 +102,9 @@ static void PrintUniformityInfo(Layer* aLayer) {
|
|||
}
|
||||
|
||||
Point translation = transform.As2D().GetTranslation();
|
||||
profiler_add_marker("LayerTranslation", JS::ProfilingCategoryPair::GRAPHICS,
|
||||
MakeUnique<LayerTranslationMarkerPayload>(
|
||||
aLayer, translation, TimeStamp::Now()));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("LayerTranslation", GRAPHICS,
|
||||
LayerTranslationMarkerPayload,
|
||||
(aLayer, translation, TimeStamp::Now()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1976,8 +1976,8 @@ already_AddRefed<IAPZCTreeManager> CompositorBridgeParent::GetAPZCTreeManager(
|
|||
static void InsertVsyncProfilerMarker(TimeStamp aVsyncTimestamp) {
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
profiler_add_marker("VsyncTimestamp", JS::ProfilingCategoryPair::GRAPHICS,
|
||||
MakeUnique<VsyncMarkerPayload>(aVsyncTimestamp));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("VsyncTimestamp", GRAPHICS,
|
||||
VsyncMarkerPayload, (aVsyncTimestamp));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -101,8 +101,8 @@ void MLGPUScreenshotGrabber::MaybeProcessQueue() {
|
|||
|
||||
void MLGPUScreenshotGrabber::NotifyEmptyFrame() {
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
profiler_add_marker("NoCompositorScreenshot because nothing changed",
|
||||
JS::ProfilingCategoryPair::GRAPHICS);
|
||||
PROFILER_ADD_MARKER("NoCompositorScreenshot because nothing changed",
|
||||
GRAPHICS);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -39,11 +39,11 @@ class MOZ_RAII AutoProfilerStyleMarker {
|
|||
return;
|
||||
}
|
||||
ServoTraversalStatistics::sActive = false;
|
||||
profiler_add_marker("Styles", JS::ProfilingCategoryPair::LAYOUT,
|
||||
MakeUnique<StyleMarkerPayload>(
|
||||
mStartTime, TimeStamp::Now(), std::move(mCause),
|
||||
ServoTraversalStatistics::sSingleton, mDocShellId,
|
||||
mDocShellHistoryId));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"Styles", LAYOUT, StyleMarkerPayload,
|
||||
(mStartTime, TimeStamp::Now(), std::move(mCause),
|
||||
ServoTraversalStatistics::sSingleton, mDocShellId,
|
||||
mDocShellHistoryId));
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -4360,11 +4360,10 @@ struct Internals {
|
|||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (profiler_feature_active(ProfilerFeature::PreferenceReads)) {
|
||||
profiler_add_marker("PreferenceRead",
|
||||
JS::ProfilingCategoryPair::OTHER_PreferenceRead,
|
||||
MakeUnique<PrefMarkerPayload>(
|
||||
aPrefName, Some(aKind), Some(pref->Type()),
|
||||
PrefValueToString(aResult), TimeStamp::Now()));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"PreferenceRead", OTHER_PreferenceRead, PrefMarkerPayload,
|
||||
(aPrefName, Some(aKind), Some(pref->Type()),
|
||||
PrefValueToString(aResult), TimeStamp::Now()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -4381,11 +4380,10 @@ struct Internals {
|
|||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (profiler_feature_active(ProfilerFeature::PreferenceReads)) {
|
||||
profiler_add_marker(
|
||||
"PreferenceRead", JS::ProfilingCategoryPair::OTHER_PreferenceRead,
|
||||
MakeUnique<PrefMarkerPayload>(
|
||||
aName, Nothing() /* indicates Shared */, Some(pref->Type()),
|
||||
PrefValueToString(aResult), TimeStamp::Now()));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"PreferenceRead", OTHER_PreferenceRead, PrefMarkerPayload,
|
||||
(aName, Nothing() /* indicates Shared */, Some(pref->Type()),
|
||||
PrefValueToString(aResult), TimeStamp::Now()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
categoryPair, ctx, flags)
|
||||
|
||||
# define BASE_PROFILER_ADD_MARKER(markerName, categoryPair)
|
||||
# define BASE_PROFILER_ADD_MARKER_WITH_PAYLOAD( \
|
||||
markerName, categoryPair, PayloadType, parenthesizedPayloadArgs)
|
||||
|
||||
# define MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell)
|
||||
# define BASE_PROFILER_TRACING(categoryString, markerName, categoryPair, kind)
|
||||
|
@ -695,6 +697,18 @@ class MOZ_RAII AutoProfilerStats {
|
|||
|
||||
MFBT_API void profiler_add_marker(const char* aMarkerName,
|
||||
ProfilingCategoryPair aCategoryPair);
|
||||
|
||||
// `PayloadType` is a sub-class of BaseMarkerPayload, `parenthesizedPayloadArgs`
|
||||
// is the argument list used to construct that `PayloadType`. E.g.:
|
||||
// `BASE_PROFILER_ADD_MARKER_WITH_PAYLOAD("Load", DOM, TextMarkerPayload,
|
||||
// ("text", start, end, ds, dsh))`
|
||||
# define BASE_PROFILER_ADD_MARKER_WITH_PAYLOAD( \
|
||||
markerName, categoryPair, PayloadType, parenthesizedPayloadArgs) \
|
||||
::mozilla::baseprofiler::profiler_add_marker( \
|
||||
markerName, \
|
||||
::mozilla::baseprofiler::ProfilingCategoryPair::categoryPair, \
|
||||
::mozilla::MakeUnique<PayloadType> parenthesizedPayloadArgs)
|
||||
|
||||
MFBT_API void profiler_add_marker(const char* aMarkerName,
|
||||
ProfilingCategoryPair aCategoryPair,
|
||||
UniquePtr<ProfilerMarkerPayload> aPayload);
|
||||
|
|
|
@ -18,10 +18,9 @@ void ProfilerIOInterposeObserver::Observe(Observation& aObservation) {
|
|||
|
||||
nsString filename;
|
||||
aObservation.Filename(filename);
|
||||
profiler_add_marker(
|
||||
"FileIO", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<FileIOMarkerPayload>(
|
||||
aObservation.ObservedOperationString(), aObservation.Reference(),
|
||||
NS_ConvertUTF16toUTF8(filename).get(), aObservation.Start(),
|
||||
aObservation.End(), std::move(stack)));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"FileIO", OTHER, FileIOMarkerPayload,
|
||||
(aObservation.ObservedOperationString(), aObservation.Reference(),
|
||||
NS_ConvertUTF16toUTF8(filename).get(), aObservation.Start(),
|
||||
aObservation.End(), std::move(stack)));
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ nsProfiler::ResumeSampling() {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsProfiler::AddMarker(const char* aMarker) {
|
||||
profiler_add_marker(aMarker, JS::ProfilingCategoryPair::OTHER);
|
||||
PROFILER_ADD_MARKER(aMarker, OTHER);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
ctx, flags)
|
||||
|
||||
# define PROFILER_ADD_MARKER(markerName, categoryPair)
|
||||
# define PROFILER_ADD_MARKER_WITH_PAYLOAD(markerName, categoryPair, \
|
||||
PayloadType, payloadArgs)
|
||||
# define PROFILER_ADD_NETWORK_MARKER(uri, pri, channel, type, start, end, \
|
||||
count, cache, timings, redirect)
|
||||
|
||||
|
@ -675,10 +677,21 @@ mozilla::Maybe<ProfilerBufferInfo> profiler_get_buffer_info();
|
|||
// mode.
|
||||
|
||||
# define PROFILER_ADD_MARKER(markerName, categoryPair) \
|
||||
profiler_add_marker(markerName, JS::ProfilingCategoryPair::categoryPair)
|
||||
::profiler_add_marker(markerName, ::JS::ProfilingCategoryPair::categoryPair)
|
||||
|
||||
void profiler_add_marker(const char* aMarkerName,
|
||||
JS::ProfilingCategoryPair aCategoryPair);
|
||||
|
||||
// `PayloadType` is a sub-class of MarkerPayload, `parenthesizedPayloadArgs` is
|
||||
// the argument list used to construct that `PayloadType`. E.g.:
|
||||
// `PROFILER_ADD_MARKER_WITH_PAYLOAD("Load", DOM, TextMarkerPayload,
|
||||
// ("text", start, end, ds, dsh))`
|
||||
# define PROFILER_ADD_MARKER_WITH_PAYLOAD( \
|
||||
markerName, categoryPair, PayloadType, parenthesizedPayloadArgs) \
|
||||
::profiler_add_marker( \
|
||||
markerName, ::JS::ProfilingCategoryPair::categoryPair, \
|
||||
::mozilla::MakeUnique<PayloadType> parenthesizedPayloadArgs)
|
||||
|
||||
void profiler_add_marker(const char* aMarkerName,
|
||||
JS::ProfilingCategoryPair aCategoryPair,
|
||||
mozilla::UniquePtr<ProfilerMarkerPayload> aPayload);
|
||||
|
|
|
@ -530,18 +530,17 @@ TEST(GeckoProfiler, Markers)
|
|||
|
||||
{ AUTO_PROFILER_TRACING("C", "A", OTHER); }
|
||||
|
||||
profiler_add_marker("M1", JS::ProfilingCategoryPair::OTHER);
|
||||
profiler_add_marker("M2", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<TracingMarkerPayload>("C", TRACING_EVENT));
|
||||
PROFILER_ADD_MARKER("M1", OTHER);
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("M2", OTHER, TracingMarkerPayload,
|
||||
("C", TRACING_EVENT));
|
||||
PROFILER_ADD_MARKER("M3", OTHER);
|
||||
profiler_add_marker("M4", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<TracingMarkerPayload>(
|
||||
"C", TRACING_EVENT, mozilla::Nothing(),
|
||||
mozilla::Nothing(), profiler_get_backtrace()));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"M4", OTHER, TracingMarkerPayload,
|
||||
("C", TRACING_EVENT, mozilla::Nothing(), mozilla::Nothing(),
|
||||
profiler_get_backtrace()));
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
profiler_add_marker("M5", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<GTestMarkerPayload>(i));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("M5", OTHER, GTestMarkerPayload, (i));
|
||||
}
|
||||
|
||||
// Create two strings: one that is the maximum allowed length, and one that
|
||||
|
@ -628,8 +627,7 @@ TEST(GeckoProfiler, Markers)
|
|||
ASSERT_TRUE(GTestMarkerPayload::sNumDestroyed == 10);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
profiler_add_marker("M5", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<GTestMarkerPayload>(i));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("M5", OTHER, GTestMarkerPayload, (i));
|
||||
}
|
||||
|
||||
// Warning: this could be racy
|
||||
|
@ -659,11 +657,9 @@ TEST(GeckoProfiler, DurationLimit)
|
|||
GTestMarkerPayload::sNumStreamed = 0;
|
||||
GTestMarkerPayload::sNumDestroyed = 0;
|
||||
|
||||
profiler_add_marker("M1", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<GTestMarkerPayload>(1));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("M1", OTHER, GTestMarkerPayload, (1));
|
||||
PR_Sleep(PR_MillisecondsToInterval(1100));
|
||||
profiler_add_marker("M2", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<GTestMarkerPayload>(2));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("M2", OTHER, GTestMarkerPayload, (2));
|
||||
PR_Sleep(PR_MillisecondsToInterval(500));
|
||||
|
||||
SpliceableChunkedJSONWriter w;
|
||||
|
|
|
@ -841,17 +841,15 @@ void CycleCollectedJSRuntime::GCSliceCallback(JSContext* aContext,
|
|||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
if (aProgress == JS::GC_CYCLE_END) {
|
||||
profiler_add_marker(
|
||||
"GCMajor", JS::ProfilingCategoryPair::GCCC,
|
||||
MakeUnique<GCMajorMarkerPayload>(aDesc.startTime(aContext),
|
||||
aDesc.endTime(aContext),
|
||||
aDesc.formatJSONProfiler(aContext)));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"GCMajor", GCCC, GCMajorMarkerPayload,
|
||||
(aDesc.startTime(aContext), aDesc.endTime(aContext),
|
||||
aDesc.formatJSONProfiler(aContext)));
|
||||
} else if (aProgress == JS::GC_SLICE_END) {
|
||||
profiler_add_marker(
|
||||
"GCSlice", JS::ProfilingCategoryPair::GCCC,
|
||||
MakeUnique<GCSliceMarkerPayload>(
|
||||
aDesc.lastSliceStart(aContext), aDesc.lastSliceEnd(aContext),
|
||||
aDesc.sliceToJSONProfiler(aContext)));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"GCSlice", GCCC, GCSliceMarkerPayload,
|
||||
(aDesc.lastSliceStart(aContext), aDesc.lastSliceEnd(aContext),
|
||||
aDesc.sliceToJSONProfiler(aContext)));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -930,10 +928,10 @@ void CycleCollectedJSRuntime::GCNurseryCollectionCallback(
|
|||
#ifdef MOZ_GECKO_PROFILER
|
||||
else if (aProgress == JS::GCNurseryProgress::GC_NURSERY_COLLECTION_END &&
|
||||
profiler_thread_is_being_profiled()) {
|
||||
profiler_add_marker("GCMinor", JS::ProfilingCategoryPair::GCCC,
|
||||
MakeUnique<GCMinorMarkerPayload>(
|
||||
self->mLatestNurseryCollectionStart,
|
||||
TimeStamp::Now(), JS::MinorGcToJSON(aContext)));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
"GCMinor", GCCC, GCMinorMarkerPayload,
|
||||
(self->mLatestNurseryCollectionStart, TimeStamp::Now(),
|
||||
JS::MinorGcToJSON(aContext)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -407,9 +407,8 @@ class LogModuleManager {
|
|||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (mAddProfilerMarker && profiler_is_active()) {
|
||||
profiler_add_marker(
|
||||
"LogMessages", JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<LogMarkerPayload>(aName, buffToWrite, TimeStamp::Now()));
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD("LogMessages", OTHER, LogMarkerPayload,
|
||||
(aName, buffToWrite, TimeStamp::Now()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1237,11 +1237,10 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult) {
|
|||
mLastLongTaskEnd = now;
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
profiler_add_marker(
|
||||
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
||||
(priority != EventQueuePriority::Idle) ? "LongTask"
|
||||
: "LongIdleTask",
|
||||
JS::ProfilingCategoryPair::OTHER,
|
||||
MakeUnique<LongTaskMarkerPayload>(mCurrentEventStart, now));
|
||||
OTHER, LongTaskMarkerPayload, (mCurrentEventStart, now));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче