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:
Gerald Squelart 2019-09-04 07:56:51 +00:00
Родитель fdea67edb5
Коммит 95f77c2409
21 изменённых файлов: 130 добавлений и 122 удалений

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

@ -839,7 +839,7 @@ nsresult Accessible::HandleAccEvent(AccEvent* aEvent) {
nsAutoCString strMarker; nsAutoCString strMarker;
strMarker.AppendLiteral("A11y Event - "); strMarker.AppendLiteral("A11y Event - ");
strMarker.Append(strEventType); strMarker.Append(strEventType);
profiler_add_marker(strMarker.get(), JS::ProfilingCategoryPair::OTHER); PROFILER_ADD_MARKER(strMarker.get(), OTHER);
} }
#endif #endif

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

@ -155,11 +155,9 @@ void TimeoutManager::MoveIdleToActive() {
int(elapsed.ToMilliseconds()), int(target.ToMilliseconds()), int(elapsed.ToMilliseconds()), int(target.ToMilliseconds()),
int(delta.ToMilliseconds())); int(delta.ToMilliseconds()));
// don't have end before start... // don't have end before start...
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"setTimeout deferred release", JS::ProfilingCategoryPair::DOM, "setTimeout deferred release", DOM, TextMarkerPayload,
MakeUnique<TextMarkerPayload>( (marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now, now));
marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now,
now));
} }
#endif #endif
num++; num++;
@ -906,11 +904,10 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
int(elapsed.ToMilliseconds()), int(target.ToMilliseconds()), int(elapsed.ToMilliseconds()), int(target.ToMilliseconds()),
int(delta.ToMilliseconds()), int(runtime.ToMilliseconds())); int(delta.ToMilliseconds()), int(runtime.ToMilliseconds()));
// don't have end before start... // don't have end before start...
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"setTimeout", JS::ProfilingCategoryPair::DOM, "setTimeout", DOM, TextMarkerPayload,
MakeUnique<TextMarkerPayload>( (marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now,
marker, delta.ToMilliseconds() >= 0 ? timeout->When() : now, now));
now));
} }
#endif #endif

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

@ -165,9 +165,8 @@ void nsDOMNavigationTiming::NotifyLoadEventEnd() {
int(elapsed.ToMilliseconds()), int(duration.ToMilliseconds())); int(elapsed.ToMilliseconds()), int(duration.ToMilliseconds()));
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell); DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
PAGELOAD_LOG(("%s", marker.get())); PAGELOAD_LOG(("%s", marker.get()));
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD("DocumentLoad", DOM, TextMarkerPayload,
"DocumentLoad", JS::ProfilingCategoryPair::DOM, (marker, mNavigationStart, mLoadEventEnd,
MakeUnique<TextMarkerPayload>(marker, mNavigationStart, mLoadEventEnd,
docShellId, docShellHistoryId)); docShellId, docShellHistoryId));
} }
#endif #endif
@ -360,10 +359,9 @@ void nsDOMNavigationTiming::TTITimeout(nsITimer* aTimer) {
int(elapsedLongTask.ToMilliseconds()), spec.get()); int(elapsedLongTask.ToMilliseconds()), spec.get());
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell); DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"TTFI", JS::ProfilingCategoryPair::DOM, "TTFI", DOM, TextMarkerPayload,
MakeUnique<TextMarkerPayload>(marker, mNavigationStart, mTTFI, (marker, mNavigationStart, mTTFI, docShellId, docShellHistoryId));
docShellId, docShellHistoryId));
} }
#endif #endif
return; return;
@ -395,9 +393,9 @@ void nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument() {
"and first non-blank paint"); "and first non-blank paint");
PAGELOAD_LOG(("%s", marker.get())); PAGELOAD_LOG(("%s", marker.get()));
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell); DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD("FirstNonBlankPaint", DOM,
"FirstNonBlankPaint", JS::ProfilingCategoryPair::DOM, TextMarkerPayload,
MakeUnique<TextMarkerPayload>(marker, mNavigationStart, mNonBlankPaint, (marker, mNavigationStart, mNonBlankPaint,
docShellId, docShellHistoryId)); docShellId, docShellHistoryId));
} }
#endif #endif
@ -445,10 +443,10 @@ void nsDOMNavigationTiming::NotifyContentfulPaintForRootContentDocument(
"and first non-blank paint"); "and first non-blank paint");
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell); DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
PAGELOAD_LOG(("%s", marker.get())); PAGELOAD_LOG(("%s", marker.get()));
profiler_add_marker("FirstContentfulPaint", JS::ProfilingCategoryPair::DOM, PROFILER_ADD_MARKER_WITH_PAYLOAD(
MakeUnique<TextMarkerPayload>( "FirstContentfulPaint", DOM, TextMarkerPayload,
marker, mNavigationStart, mContentfulPaint, (marker, mNavigationStart, mContentfulPaint, docShellId,
docShellId, docShellHistoryId)); docShellHistoryId));
} }
#endif #endif
@ -495,10 +493,10 @@ void nsDOMNavigationTiming::NotifyDOMContentFlushedForRootContentDocument() {
"and DOMContentFlushed"); "and DOMContentFlushed");
DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell); DECLARE_DOCSHELL_AND_HISTORY_ID(mDocShell);
PAGELOAD_LOG(("%s", marker.get())); PAGELOAD_LOG(("%s", marker.get()));
profiler_add_marker("DOMContentFlushed", JS::ProfilingCategoryPair::DOM, PROFILER_ADD_MARKER_WITH_PAYLOAD(
MakeUnique<TextMarkerPayload>( "DOMContentFlushed", DOM, TextMarkerPayload,
marker, mNavigationStart, mDOMContentFlushed, (marker, mNavigationStart, mDOMContentFlushed, docShellId,
docShellId, docShellHistoryId)); docShellHistoryId));
} }
#endif #endif
} }

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

@ -1027,20 +1027,18 @@ nsresult EventDispatcher::Dispatch(nsISupports* aTarget,
nsCOMPtr<nsIDocShell> docShell; nsCOMPtr<nsIDocShell> docShell;
docShell = nsContentUtils::GetDocShellForEventTarget(aEvent->mTarget); docShell = nsContentUtils::GetDocShellForEventTarget(aEvent->mTarget);
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"DOMEvent", JS::ProfilingCategoryPair::DOM, "DOMEvent", DOM, DOMEventMarkerPayload,
MakeUnique<DOMEventMarkerPayload>( (typeStr, aEvent->mTimeStamp, "DOMEvent", TRACING_INTERVAL_START,
typeStr, aEvent->mTimeStamp, "DOMEvent", docShellId, docShellHistoryId));
TRACING_INTERVAL_START, docShellId, docShellHistoryId));
EventTargetChainItem::HandleEventTargetChain(chain, postVisitor, EventTargetChainItem::HandleEventTargetChain(chain, postVisitor,
aCallback, cd); aCallback, cd);
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"DOMEvent", JS::ProfilingCategoryPair::DOM, "DOMEvent", DOM, DOMEventMarkerPayload,
MakeUnique<DOMEventMarkerPayload>( (typeStr, aEvent->mTimeStamp, "DOMEvent", TRACING_INTERVAL_END,
typeStr, aEvent->mTimeStamp, "DOMEvent", TRACING_INTERVAL_END, docShellId, docShellHistoryId));
docShellId, docShellHistoryId));
} else } else
#endif #endif
{ {

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

@ -36,13 +36,13 @@ extern LazyLogModule gMediaDecoderLog;
MOZ_LOG(gMediaDecoderLog, LogLevel::Verbose, (FMT(x, ##__VA_ARGS__))) MOZ_LOG(gMediaDecoderLog, LogLevel::Verbose, (FMT(x, ##__VA_ARGS__)))
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
# define VSINK_ADD_PROFILER_MARKER(tag, markerTime, aTime, vTime) \ # define VSINK_ADD_PROFILER_MARKER(tag, markerTime, aTime, vTime) \
do { \ do { \
if (profiler_thread_is_being_profiled()) { \ if (profiler_thread_is_being_profiled()) { \
profiler_add_marker( \ PROFILER_ADD_MARKER_WITH_PAYLOAD(tag, GRAPHICS, \
tag, JS::ProfilingCategoryPair::GRAPHICS, \ VideoFrameMarkerPayload, \
MakeUnique<VideoFrameMarkerPayload>(markerTime, aTime, vTime)); \ (markerTime, aTime, vTime)); \
} \ } \
} while (0) } while (0)
class VideoFrameMarkerPayload : public ProfilerMarkerPayload { class VideoFrameMarkerPayload : public ProfilerMarkerPayload {

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

@ -226,10 +226,9 @@ void Performance::Mark(const nsAString& aName, ErrorResult& aRv) {
nsCOMPtr<nsIDocShell> docShell = nsCOMPtr<nsIDocShell> docShell =
nsContentUtils::GetDocShellForEventTarget(et); nsContentUtils::GetDocShellForEventTarget(et);
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"UserTiming", JS::ProfilingCategoryPair::DOM, "UserTiming", DOM, UserTimingMarkerPayload,
MakeUnique<UserTimingMarkerPayload>(aName, TimeStamp::Now(), docShellId, (aName, TimeStamp::Now(), docShellId, docShellHistoryId));
docShellHistoryId));
} }
#endif #endif
} }
@ -327,10 +326,10 @@ void Performance::Measure(const nsAString& aName,
nsCOMPtr<nsIDocShell> docShell = nsCOMPtr<nsIDocShell> docShell =
nsContentUtils::GetDocShellForEventTarget(et); nsContentUtils::GetDocShellForEventTarget(et);
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); DECLARE_DOCSHELL_AND_HISTORY_ID(docShell);
profiler_add_marker("UserTiming", JS::ProfilingCategoryPair::DOM, PROFILER_ADD_MARKER_WITH_PAYLOAD(
MakeUnique<UserTimingMarkerPayload>( "UserTiming", DOM, UserTimingMarkerPayload,
aName, startMark, endMark, startTimeStamp, (aName, startMark, endMark, startTimeStamp, endTimeStamp, docShellId,
endTimeStamp, docShellId, docShellHistoryId)); docShellHistoryId));
} }
#endif #endif
} }

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

@ -2324,7 +2324,7 @@ void RecordCompositionPayloadsPresented(
"Payload Presented, type: %d latency: %dms\n", "Payload Presented, type: %d latency: %dms\n",
int32_t(payload.mType), int32_t(payload.mType),
int32_t((presented - payload.mTimeStamp).ToMilliseconds())); int32_t((presented - payload.mTimeStamp).ToMilliseconds()));
profiler_add_marker(marker.get(), JS::ProfilingCategoryPair::GRAPHICS); PROFILER_ADD_MARKER(marker.get(), GRAPHICS);
} }
#endif #endif

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

@ -89,8 +89,8 @@ void CompositorScreenshotGrabber::MaybeProcessQueue() {
void CompositorScreenshotGrabber::NotifyEmptyFrame() { void CompositorScreenshotGrabber::NotifyEmptyFrame() {
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
profiler_add_marker("NoCompositorScreenshot because nothing changed", PROFILER_ADD_MARKER("NoCompositorScreenshot because nothing changed",
JS::ProfilingCategoryPair::GRAPHICS); GRAPHICS);
#endif #endif
} }

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

@ -102,9 +102,9 @@ static void PrintUniformityInfo(Layer* aLayer) {
} }
Point translation = transform.As2D().GetTranslation(); Point translation = transform.As2D().GetTranslation();
profiler_add_marker("LayerTranslation", JS::ProfilingCategoryPair::GRAPHICS, PROFILER_ADD_MARKER_WITH_PAYLOAD("LayerTranslation", GRAPHICS,
MakeUnique<LayerTranslationMarkerPayload>( LayerTranslationMarkerPayload,
aLayer, translation, TimeStamp::Now())); (aLayer, translation, TimeStamp::Now()));
#endif #endif
} }

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

@ -1976,8 +1976,8 @@ already_AddRefed<IAPZCTreeManager> CompositorBridgeParent::GetAPZCTreeManager(
static void InsertVsyncProfilerMarker(TimeStamp aVsyncTimestamp) { static void InsertVsyncProfilerMarker(TimeStamp aVsyncTimestamp) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
if (profiler_thread_is_being_profiled()) { if (profiler_thread_is_being_profiled()) {
profiler_add_marker("VsyncTimestamp", JS::ProfilingCategoryPair::GRAPHICS, PROFILER_ADD_MARKER_WITH_PAYLOAD("VsyncTimestamp", GRAPHICS,
MakeUnique<VsyncMarkerPayload>(aVsyncTimestamp)); VsyncMarkerPayload, (aVsyncTimestamp));
} }
} }
#endif #endif

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

@ -101,8 +101,8 @@ void MLGPUScreenshotGrabber::MaybeProcessQueue() {
void MLGPUScreenshotGrabber::NotifyEmptyFrame() { void MLGPUScreenshotGrabber::NotifyEmptyFrame() {
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
profiler_add_marker("NoCompositorScreenshot because nothing changed", PROFILER_ADD_MARKER("NoCompositorScreenshot because nothing changed",
JS::ProfilingCategoryPair::GRAPHICS); GRAPHICS);
#endif #endif
} }

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

@ -39,11 +39,11 @@ class MOZ_RAII AutoProfilerStyleMarker {
return; return;
} }
ServoTraversalStatistics::sActive = false; ServoTraversalStatistics::sActive = false;
profiler_add_marker("Styles", JS::ProfilingCategoryPair::LAYOUT, PROFILER_ADD_MARKER_WITH_PAYLOAD(
MakeUnique<StyleMarkerPayload>( "Styles", LAYOUT, StyleMarkerPayload,
mStartTime, TimeStamp::Now(), std::move(mCause), (mStartTime, TimeStamp::Now(), std::move(mCause),
ServoTraversalStatistics::sSingleton, mDocShellId, ServoTraversalStatistics::sSingleton, mDocShellId,
mDocShellHistoryId)); mDocShellHistoryId));
} }
private: private:

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

@ -4360,11 +4360,10 @@ struct Internals {
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
if (profiler_feature_active(ProfilerFeature::PreferenceReads)) { if (profiler_feature_active(ProfilerFeature::PreferenceReads)) {
profiler_add_marker("PreferenceRead", PROFILER_ADD_MARKER_WITH_PAYLOAD(
JS::ProfilingCategoryPair::OTHER_PreferenceRead, "PreferenceRead", OTHER_PreferenceRead, PrefMarkerPayload,
MakeUnique<PrefMarkerPayload>( (aPrefName, Some(aKind), Some(pref->Type()),
aPrefName, Some(aKind), Some(pref->Type()), PrefValueToString(aResult), TimeStamp::Now()));
PrefValueToString(aResult), TimeStamp::Now()));
} }
#endif #endif
} }
@ -4381,11 +4380,10 @@ struct Internals {
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
if (profiler_feature_active(ProfilerFeature::PreferenceReads)) { if (profiler_feature_active(ProfilerFeature::PreferenceReads)) {
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"PreferenceRead", JS::ProfilingCategoryPair::OTHER_PreferenceRead, "PreferenceRead", OTHER_PreferenceRead, PrefMarkerPayload,
MakeUnique<PrefMarkerPayload>( (aName, Nothing() /* indicates Shared */, Some(pref->Type()),
aName, Nothing() /* indicates Shared */, Some(pref->Type()), PrefValueToString(aResult), TimeStamp::Now()));
PrefValueToString(aResult), TimeStamp::Now()));
} }
#endif #endif
} }

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

@ -65,6 +65,8 @@
categoryPair, ctx, flags) categoryPair, ctx, flags)
# define BASE_PROFILER_ADD_MARKER(markerName, categoryPair) # 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 MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell)
# define BASE_PROFILER_TRACING(categoryString, markerName, categoryPair, kind) # 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, MFBT_API void profiler_add_marker(const char* aMarkerName,
ProfilingCategoryPair aCategoryPair); 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, MFBT_API void profiler_add_marker(const char* aMarkerName,
ProfilingCategoryPair aCategoryPair, ProfilingCategoryPair aCategoryPair,
UniquePtr<ProfilerMarkerPayload> aPayload); UniquePtr<ProfilerMarkerPayload> aPayload);

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

@ -18,10 +18,9 @@ void ProfilerIOInterposeObserver::Observe(Observation& aObservation) {
nsString filename; nsString filename;
aObservation.Filename(filename); aObservation.Filename(filename);
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"FileIO", JS::ProfilingCategoryPair::OTHER, "FileIO", OTHER, FileIOMarkerPayload,
MakeUnique<FileIOMarkerPayload>( (aObservation.ObservedOperationString(), aObservation.Reference(),
aObservation.ObservedOperationString(), aObservation.Reference(), NS_ConvertUTF16toUTF8(filename).get(), aObservation.Start(),
NS_ConvertUTF16toUTF8(filename).get(), aObservation.Start(), aObservation.End(), std::move(stack)));
aObservation.End(), std::move(stack)));
} }

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

@ -173,7 +173,7 @@ nsProfiler::ResumeSampling() {
NS_IMETHODIMP NS_IMETHODIMP
nsProfiler::AddMarker(const char* aMarker) { nsProfiler::AddMarker(const char* aMarker) {
profiler_add_marker(aMarker, JS::ProfilingCategoryPair::OTHER); PROFILER_ADD_MARKER(aMarker, OTHER);
return NS_OK; return NS_OK;
} }

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

@ -51,6 +51,8 @@
ctx, flags) ctx, flags)
# define PROFILER_ADD_MARKER(markerName, categoryPair) # 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, \ # define PROFILER_ADD_NETWORK_MARKER(uri, pri, channel, type, start, end, \
count, cache, timings, redirect) count, cache, timings, redirect)
@ -675,10 +677,21 @@ mozilla::Maybe<ProfilerBufferInfo> profiler_get_buffer_info();
// mode. // mode.
# define PROFILER_ADD_MARKER(markerName, categoryPair) \ # 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, void profiler_add_marker(const char* aMarkerName,
JS::ProfilingCategoryPair aCategoryPair); 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, void profiler_add_marker(const char* aMarkerName,
JS::ProfilingCategoryPair aCategoryPair, JS::ProfilingCategoryPair aCategoryPair,
mozilla::UniquePtr<ProfilerMarkerPayload> aPayload); mozilla::UniquePtr<ProfilerMarkerPayload> aPayload);

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

@ -530,18 +530,17 @@ TEST(GeckoProfiler, Markers)
{ AUTO_PROFILER_TRACING("C", "A", OTHER); } { AUTO_PROFILER_TRACING("C", "A", OTHER); }
profiler_add_marker("M1", JS::ProfilingCategoryPair::OTHER); PROFILER_ADD_MARKER("M1", OTHER);
profiler_add_marker("M2", JS::ProfilingCategoryPair::OTHER, PROFILER_ADD_MARKER_WITH_PAYLOAD("M2", OTHER, TracingMarkerPayload,
MakeUnique<TracingMarkerPayload>("C", TRACING_EVENT)); ("C", TRACING_EVENT));
PROFILER_ADD_MARKER("M3", OTHER); PROFILER_ADD_MARKER("M3", OTHER);
profiler_add_marker("M4", JS::ProfilingCategoryPair::OTHER, PROFILER_ADD_MARKER_WITH_PAYLOAD(
MakeUnique<TracingMarkerPayload>( "M4", OTHER, TracingMarkerPayload,
"C", TRACING_EVENT, mozilla::Nothing(), ("C", TRACING_EVENT, mozilla::Nothing(), mozilla::Nothing(),
mozilla::Nothing(), profiler_get_backtrace())); profiler_get_backtrace()));
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
profiler_add_marker("M5", JS::ProfilingCategoryPair::OTHER, PROFILER_ADD_MARKER_WITH_PAYLOAD("M5", OTHER, GTestMarkerPayload, (i));
MakeUnique<GTestMarkerPayload>(i));
} }
// Create two strings: one that is the maximum allowed length, and one that // 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); ASSERT_TRUE(GTestMarkerPayload::sNumDestroyed == 10);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
profiler_add_marker("M5", JS::ProfilingCategoryPair::OTHER, PROFILER_ADD_MARKER_WITH_PAYLOAD("M5", OTHER, GTestMarkerPayload, (i));
MakeUnique<GTestMarkerPayload>(i));
} }
// Warning: this could be racy // Warning: this could be racy
@ -659,11 +657,9 @@ TEST(GeckoProfiler, DurationLimit)
GTestMarkerPayload::sNumStreamed = 0; GTestMarkerPayload::sNumStreamed = 0;
GTestMarkerPayload::sNumDestroyed = 0; GTestMarkerPayload::sNumDestroyed = 0;
profiler_add_marker("M1", JS::ProfilingCategoryPair::OTHER, PROFILER_ADD_MARKER_WITH_PAYLOAD("M1", OTHER, GTestMarkerPayload, (1));
MakeUnique<GTestMarkerPayload>(1));
PR_Sleep(PR_MillisecondsToInterval(1100)); PR_Sleep(PR_MillisecondsToInterval(1100));
profiler_add_marker("M2", JS::ProfilingCategoryPair::OTHER, PROFILER_ADD_MARKER_WITH_PAYLOAD("M2", OTHER, GTestMarkerPayload, (2));
MakeUnique<GTestMarkerPayload>(2));
PR_Sleep(PR_MillisecondsToInterval(500)); PR_Sleep(PR_MillisecondsToInterval(500));
SpliceableChunkedJSONWriter w; SpliceableChunkedJSONWriter w;

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

@ -841,17 +841,15 @@ void CycleCollectedJSRuntime::GCSliceCallback(JSContext* aContext,
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
if (profiler_thread_is_being_profiled()) { if (profiler_thread_is_being_profiled()) {
if (aProgress == JS::GC_CYCLE_END) { if (aProgress == JS::GC_CYCLE_END) {
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"GCMajor", JS::ProfilingCategoryPair::GCCC, "GCMajor", GCCC, GCMajorMarkerPayload,
MakeUnique<GCMajorMarkerPayload>(aDesc.startTime(aContext), (aDesc.startTime(aContext), aDesc.endTime(aContext),
aDesc.endTime(aContext), aDesc.formatJSONProfiler(aContext)));
aDesc.formatJSONProfiler(aContext)));
} else if (aProgress == JS::GC_SLICE_END) { } else if (aProgress == JS::GC_SLICE_END) {
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
"GCSlice", JS::ProfilingCategoryPair::GCCC, "GCSlice", GCCC, GCSliceMarkerPayload,
MakeUnique<GCSliceMarkerPayload>( (aDesc.lastSliceStart(aContext), aDesc.lastSliceEnd(aContext),
aDesc.lastSliceStart(aContext), aDesc.lastSliceEnd(aContext), aDesc.sliceToJSONProfiler(aContext)));
aDesc.sliceToJSONProfiler(aContext)));
} }
} }
#endif #endif
@ -930,10 +928,10 @@ void CycleCollectedJSRuntime::GCNurseryCollectionCallback(
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
else if (aProgress == JS::GCNurseryProgress::GC_NURSERY_COLLECTION_END && else if (aProgress == JS::GCNurseryProgress::GC_NURSERY_COLLECTION_END &&
profiler_thread_is_being_profiled()) { profiler_thread_is_being_profiled()) {
profiler_add_marker("GCMinor", JS::ProfilingCategoryPair::GCCC, PROFILER_ADD_MARKER_WITH_PAYLOAD(
MakeUnique<GCMinorMarkerPayload>( "GCMinor", GCCC, GCMinorMarkerPayload,
self->mLatestNurseryCollectionStart, (self->mLatestNurseryCollectionStart, TimeStamp::Now(),
TimeStamp::Now(), JS::MinorGcToJSON(aContext))); JS::MinorGcToJSON(aContext)));
} }
#endif #endif

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

@ -407,9 +407,8 @@ class LogModuleManager {
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
if (mAddProfilerMarker && profiler_is_active()) { if (mAddProfilerMarker && profiler_is_active()) {
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD("LogMessages", OTHER, LogMarkerPayload,
"LogMessages", JS::ProfilingCategoryPair::OTHER, (aName, buffToWrite, TimeStamp::Now()));
MakeUnique<LogMarkerPayload>(aName, buffToWrite, TimeStamp::Now()));
} }
#endif #endif

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

@ -1237,11 +1237,10 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult) {
mLastLongTaskEnd = now; mLastLongTaskEnd = now;
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
if (profiler_thread_is_being_profiled()) { if (profiler_thread_is_being_profiled()) {
profiler_add_marker( PROFILER_ADD_MARKER_WITH_PAYLOAD(
(priority != EventQueuePriority::Idle) ? "LongTask" (priority != EventQueuePriority::Idle) ? "LongTask"
: "LongIdleTask", : "LongIdleTask",
JS::ProfilingCategoryPair::OTHER, OTHER, LongTaskMarkerPayload, (mCurrentEventStart, now));
MakeUnique<LongTaskMarkerPayload>(mCurrentEventStart, now));
} }
#endif #endif
} }