Bug 1375299 (part 2) - Remove PROFILER_MARKER. r=mstange.

PROFILER_MARKER is now just a trivial wrapper for profiler_add_marker(). This
patch removes it.

--HG--
extra : rebase_source : 9858f34763bb343757896a91ab7ad8bd8e56b076
This commit is contained in:
Nicholas Nethercote 2017-06-22 13:40:21 +10:00
Родитель 4b364cf3f3
Коммит 915a56fb41
20 изменённых файлов: 39 добавлений и 46 удалений

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

@ -80,7 +80,7 @@ nsDOMNavigationTiming::NotifyNavigationStart(DocShellState aDocShellState)
mNavigationStartHighRes = (double)PR_Now() / PR_USEC_PER_MSEC; mNavigationStartHighRes = (double)PR_Now() / PR_USEC_PER_MSEC;
mNavigationStartTimeStamp = TimeStamp::Now(); mNavigationStartTimeStamp = TimeStamp::Now();
mDocShellHasBeenActiveSinceNavigationStart = (aDocShellState == DocShellState::eActive); mDocShellHasBeenActiveSinceNavigationStart = (aDocShellState == DocShellState::eActive);
PROFILER_MARKER("Navigation::Start"); profiler_add_marker("Navigation::Start");
} }
void void
@ -169,7 +169,7 @@ nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI)
mDOMLoading = DurationFromStart(); mDOMLoading = DurationFromStart();
mDOMLoadingSet = true; mDOMLoadingSet = true;
PROFILER_MARKER("Navigation::DOMLoading"); profiler_add_marker("Navigation::DOMLoading");
if (IsTopLevelContentDocument()) { if (IsTopLevelContentDocument()) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_LOADING_MS, Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_LOADING_MS,
@ -186,7 +186,7 @@ nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI)
mDOMInteractive = DurationFromStart(); mDOMInteractive = DurationFromStart();
mDOMInteractiveSet = true; mDOMInteractiveSet = true;
PROFILER_MARKER("Navigation::DOMInteractive"); profiler_add_marker("Navigation::DOMInteractive");
if (IsTopLevelContentDocument()) { if (IsTopLevelContentDocument()) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_INTERACTIVE_MS, Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_INTERACTIVE_MS,
@ -203,7 +203,7 @@ nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI)
mDOMComplete = DurationFromStart(); mDOMComplete = DurationFromStart();
mDOMCompleteSet = true; mDOMCompleteSet = true;
PROFILER_MARKER("Navigation::DOMComplete"); profiler_add_marker("Navigation::DOMComplete");
if (IsTopLevelContentDocument()) { if (IsTopLevelContentDocument()) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_COMPLETE_MS, Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_COMPLETE_MS,
@ -267,7 +267,7 @@ nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument()
nsPrintfCString marker("Non-blank paint after %dms for URL %s, %s", nsPrintfCString marker("Non-blank paint after %dms for URL %s, %s",
int(elapsed.ToMilliseconds()), spec.get(), int(elapsed.ToMilliseconds()), spec.get(),
mDocShellHasBeenActiveSinceNavigationStart ? "foreground tab" : "this tab was inactive some of the time between navigation start and first non-blank paint"); mDocShellHasBeenActiveSinceNavigationStart ? "foreground tab" : "this tab was inactive some of the time between navigation start and first non-blank paint");
PROFILER_MARKER(marker.get()); profiler_add_marker(marker.get());
} }
if (mDocShellHasBeenActiveSinceNavigationStart) { if (mDocShellHasBeenActiveSinceNavigationStart) {

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

@ -3394,7 +3394,7 @@ PrepareForFullscreenChange(nsIPresShell* aPresShell, const nsSize& aSize,
NS_IMETHODIMP NS_IMETHODIMP
nsDOMWindowUtils::HandleFullscreenRequests(bool* aRetVal) nsDOMWindowUtils::HandleFullscreenRequests(bool* aRetVal)
{ {
PROFILER_MARKER("Enter fullscreen"); profiler_add_marker("Enter fullscreen");
nsCOMPtr<nsIDocument> doc = GetDocument(); nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc); NS_ENSURE_STATE(doc);
@ -3417,7 +3417,7 @@ nsDOMWindowUtils::HandleFullscreenRequests(bool* aRetVal)
nsresult nsresult
nsDOMWindowUtils::ExitFullscreen() nsDOMWindowUtils::ExitFullscreen()
{ {
PROFILER_MARKER("Exit fullscreen"); profiler_add_marker("Exit fullscreen");
nsCOMPtr<nsIDocument> doc = GetDocument(); nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc); NS_ENSURE_STATE(doc);

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

@ -6972,12 +6972,12 @@ FullscreenTransitionTask::Run()
return NS_OK; return NS_OK;
} }
if (stage == eBeforeToggle) { if (stage == eBeforeToggle) {
PROFILER_MARKER("Fullscreen transition start"); profiler_add_marker("Fullscreen transition start");
mWidget->PerformFullscreenTransition(nsIWidget::eBeforeFullscreenToggle, mWidget->PerformFullscreenTransition(nsIWidget::eBeforeFullscreenToggle,
mDuration.mFadeIn, mTransitionData, mDuration.mFadeIn, mTransitionData,
this); this);
} else if (stage == eToggleFullscreen) { } else if (stage == eToggleFullscreen) {
PROFILER_MARKER("Fullscreen toggle start"); profiler_add_marker("Fullscreen toggle start");
mFullscreenChangeStartTime = TimeStamp::Now(); mFullscreenChangeStartTime = TimeStamp::Now();
if (MOZ_UNLIKELY(mWindow->mFullScreen != mFullscreen)) { if (MOZ_UNLIKELY(mWindow->mFullScreen != mFullscreen)) {
// This could happen in theory if several fullscreen requests in // This could happen in theory if several fullscreen requests in
@ -7021,7 +7021,7 @@ FullscreenTransitionTask::Run()
mDuration.mFadeOut, mTransitionData, mDuration.mFadeOut, mTransitionData,
this); this);
} else if (stage == eEnd) { } else if (stage == eEnd) {
PROFILER_MARKER("Fullscreen transition end"); profiler_add_marker("Fullscreen transition end");
} }
return NS_OK; return NS_OK;
} }
@ -7042,7 +7042,7 @@ FullscreenTransitionTask::Observer::Observe(nsISupports* aSubject,
// The paint notification arrives first. Cancel the timer. // The paint notification arrives first. Cancel the timer.
mTask->mTimer->Cancel(); mTask->mTimer->Cancel();
shouldContinue = true; shouldContinue = true;
PROFILER_MARKER("Fullscreen toggle end"); profiler_add_marker("Fullscreen toggle end");
} }
} else { } else {
#ifdef DEBUG #ifdef DEBUG
@ -7053,7 +7053,7 @@ FullscreenTransitionTask::Observer::Observe(nsISupports* aSubject,
"Should only trigger this with the timer the task created"); "Should only trigger this with the timer the task created");
#endif #endif
shouldContinue = true; shouldContinue = true;
PROFILER_MARKER("Fullscreen toggle timeout"); profiler_add_marker("Fullscreen toggle timeout");
} }
if (shouldContinue) { if (shouldContinue) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();

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

@ -1305,7 +1305,7 @@ EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
TimeStamp endTime = TimeStamp::Now(); TimeStamp endTime = TimeStamp::Now();
uint16_t phase; uint16_t phase;
(*aDOMEvent)->GetEventPhase(&phase); (*aDOMEvent)->GetEventPhase(&phase);
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"DOMEvent", "DOMEvent",
MakeUnique<DOMEventMarkerPayload>(typeStr, phase, MakeUnique<DOMEventMarkerPayload>(typeStr, phase,
startTime, endTime)); startTime, endTime));

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

@ -305,7 +305,7 @@ LoggingHelper(bool aUseProfiler, const char* aFmt, ...)
MOZ_LOG(logModule, logLevel, ("%s", message.get())); MOZ_LOG(logModule, logLevel, ("%s", message.get()));
if (aUseProfiler) { if (aUseProfiler) {
PROFILER_MARKER(message.get()); profiler_add_marker(message.get());
} }
} }
} }

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

@ -299,7 +299,7 @@ Performance::Mark(const nsAString& aName, ErrorResult& aRv)
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
if (profiler_is_active()) { if (profiler_is_active()) {
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"UserTiming", "UserTiming",
MakeUnique<UserTimingMarkerPayload>(aName, TimeStamp::Now())); MakeUnique<UserTimingMarkerPayload>(aName, TimeStamp::Now()));
} }
@ -397,7 +397,7 @@ Performance::Measure(const nsAString& aName,
TimeDuration::FromMilliseconds(startTime); TimeDuration::FromMilliseconds(startTime);
TimeStamp endTimeStamp = CreationTimeStamp() + TimeStamp endTimeStamp = CreationTimeStamp() +
TimeDuration::FromMilliseconds(endTime); TimeDuration::FromMilliseconds(endTime);
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"UserTiming", "UserTiming",
MakeUnique<UserTimingMarkerPayload>(aName, startTimeStamp, endTimeStamp)); MakeUnique<UserTimingMarkerPayload>(aName, startTimeStamp, endTimeStamp));
} }

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

@ -100,7 +100,7 @@ PrintUniformityInfo(Layer* aLayer)
} }
Point translation = transform.As2D().GetTranslation(); Point translation = transform.As2D().GetTranslation();
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"LayerTranslation", "LayerTranslation",
MakeUnique<LayerTranslationMarkerPayload>(aLayer, translation)); MakeUnique<LayerTranslationMarkerPayload>(aLayer, translation));
#endif #endif

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

@ -286,7 +286,7 @@ static void RunCompositorBench(Compositor* aCompositor, const gfx::Rect& aScreen
BenchTest* test = tests[i]; BenchTest* test = tests[i];
std::vector<TimeDuration> results; std::vector<TimeDuration> results;
int testsOverThreshold = 0; int testsOverThreshold = 0;
PROFILER_MARKER(test->ToString()); profiler_add_marker(test->ToString());
for (size_t j = 0; j < TEST_STEPS; j++) { for (size_t j = 0; j < TEST_STEPS; j++) {
test->Setup(aCompositor, j); test->Setup(aCompositor, j);

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

@ -1763,7 +1763,7 @@ InsertVsyncProfilerMarker(TimeStamp aVsyncTimestamp)
{ {
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"VsyncTimestamp", "VsyncTimestamp",
MakeUnique<VsyncMarkerPayload>(aVsyncTimestamp)); MakeUnique<VsyncMarkerPayload>(aVsyncTimestamp));
#endif #endif

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

@ -112,7 +112,7 @@ ContextStateTrackerOGL::Flush(GLContext* aGL)
aGL->fDeleteQueries(1, &handle); aGL->fDeleteQueries(1, &handle);
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"gpu_timer_query", "gpu_timer_query",
MakeUnique<GPUMarkerPayload>(mCompletedSections[0].mCpuTimeStart, MakeUnique<GPUMarkerPayload>(mCompletedSections[0].mCpuTimeStart,
mCompletedSections[0].mCpuTimeEnd, mCompletedSections[0].mCpuTimeEnd,

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

@ -71,7 +71,7 @@ public:
#ifdef MOZILLA_INTERNAL_API #ifdef MOZILLA_INTERNAL_API
static void Record(Event ev) { static void Record(Event ev) {
PROFILER_MARKER(Describe(ev)); profiler_add_marker(Describe(ev));
Record(ev, TimeStamp::Now()); Record(ev, TimeStamp::Now());
} }

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

@ -382,7 +382,7 @@ nsAppStartup::Quit(uint32_t aMode)
} }
} }
PROFILER_MARKER("Shutdown start"); profiler_add_marker("Shutdown start");
mozilla::RecordShutdownStartTimeStamp(); mozilla::RecordShutdownStartTimeStamp();
mShuttingDown = true; mShuttingDown = true;
if (!mRestart) { if (!mRestart) {

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

@ -1460,7 +1460,7 @@ ScopedXPCOMStartup::~ScopedXPCOMStartup()
appStartup->DestroyHiddenWindow(); appStartup->DestroyHiddenWindow();
gDirServiceProvider->DoShutdown(); gDirServiceProvider->DoShutdown();
PROFILER_MARKER("Shutdown early"); profiler_add_marker("Shutdown early");
WriteConsoleLog(); WriteConsoleLog();

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

@ -203,7 +203,7 @@ DOMEventMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
void void
ProfilerJSEventMarker(const char *event) ProfilerJSEventMarker(const char *event)
{ {
PROFILER_MARKER(event); profiler_add_marker(event);
} }
LayerTranslationMarkerPayload::LayerTranslationMarkerPayload(layers::Layer* aLayer, LayerTranslationMarkerPayload::LayerTranslationMarkerPayload(layers::Layer* aLayer,

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

@ -21,7 +21,7 @@ void ProfilerIOInterposeObserver::Observe(Observation& aObservation)
filename = NS_ConvertUTF16toUTF8(aObservation.Filename()); filename = NS_ConvertUTF16toUTF8(aObservation.Filename());
} }
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
aObservation.ObservedOperationString(), aObservation.ObservedOperationString(),
MakeUnique<IOMarkerPayload>(aObservation.Reference(), filename.get(), MakeUnique<IOMarkerPayload>(aObservation.Reference(), filename.get(),
aObservation.Start(), aObservation.End(), aObservation.Start(), aObservation.End(),

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

@ -168,7 +168,7 @@ nsProfiler::ResumeSampling()
NS_IMETHODIMP NS_IMETHODIMP
nsProfiler::AddMarker(const char *aMarker) nsProfiler::AddMarker(const char *aMarker)
{ {
PROFILER_MARKER(aMarker); profiler_add_marker(aMarker);
return NS_OK; return NS_OK;
} }

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

@ -112,16 +112,6 @@ using UniqueProfilerBacktrace =
PROFILER_APPEND_LINE_NUMBER(profiler_raii)(name_space "::" info, dynamicStr, \ PROFILER_APPEND_LINE_NUMBER(profiler_raii)(name_space "::" info, dynamicStr, \
__LINE__, category) __LINE__, category)
// Insert a marker in the profile timeline. This is useful to delimit something
// important happening such as the first paint. Unlike labels, which are only
// recorded in the profile buffer if a sample is collected while the label is
// on the pseudostack, markers will always be recorded in the profile buffer.
#define PROFILER_MARKER(marker_name) profiler_add_marker(marker_name)
// Like PROFILER_MARKER, but with an additional payload.
#define PROFILER_MARKER_PAYLOAD(marker_name, payload) \
profiler_add_marker(marker_name, payload)
// Higher-order macro containing all the feature info in one place. Define // Higher-order macro containing all the feature info in one place. Define
// |macro| appropriately to extract the relevant parts. Note that the number // |macro| appropriately to extract the relevant parts. Note that the number
// values are used internally only and so can be changed without consequence. // values are used internally only and so can be changed without consequence.
@ -376,8 +366,11 @@ PROFILER_FUNC_VOID(profiler_suspend_and_sample_thread(int aThreadId,
const std::function<void(void**, size_t)>& aCallback, const std::function<void(void**, size_t)>& aCallback,
bool aSampleNative = true)) bool aSampleNative = true))
// Adds a marker to the PseudoStack. A no-op if the profiler is inactive or in // Insert a marker in the profile timeline. This is useful to delimit something
// privacy mode. // important happening such as the first paint. Unlike labels, which are only
// recorded in the profile buffer if a sample is collected while the label is
// on the pseudostack, markers will always be recorded in the profile buffer.
// A no-op if the profiler is inactive or in privacy mode.
PROFILER_FUNC_VOID(profiler_add_marker(const char* aMarkerName)) PROFILER_FUNC_VOID(profiler_add_marker(const char* aMarkerName))
PROFILER_FUNC_VOID(profiler_add_marker(const char* aMarkerName, PROFILER_FUNC_VOID(profiler_add_marker(const char* aMarkerName,
mozilla::UniquePtr<ProfilerMarkerPayload> aPayload)) mozilla::UniquePtr<ProfilerMarkerPayload> aPayload))

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

@ -381,14 +381,14 @@ TEST(GeckoProfiler, Markers)
profiler_add_marker("M1"); profiler_add_marker("M1");
profiler_add_marker("M2", profiler_add_marker("M2",
MakeUnique<TracingMarkerPayload>("C", TRACING_EVENT)); MakeUnique<TracingMarkerPayload>("C", TRACING_EVENT));
PROFILER_MARKER("M3"); profiler_add_marker("M3");
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"M4", "M4",
MakeUnique<TracingMarkerPayload>("C", TRACING_EVENT, MakeUnique<TracingMarkerPayload>("C", TRACING_EVENT,
profiler_get_backtrace())); profiler_get_backtrace()));
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
PROFILER_MARKER_PAYLOAD("M5", MakeUnique<GTestMarkerPayload>(i)); profiler_add_marker("M5", MakeUnique<GTestMarkerPayload>(i));
} }
// Sleep briefly to ensure a sample is taken and the pending markers are // Sleep briefly to ensure a sample is taken and the pending markers are
@ -417,7 +417,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_MARKER_PAYLOAD("M5", MakeUnique<GTestMarkerPayload>(i)); profiler_add_marker("M5", MakeUnique<GTestMarkerPayload>(i));
} }
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,

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

@ -837,13 +837,13 @@ CycleCollectedJSRuntime::GCSliceCallback(JSContext* aContext,
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
if (profiler_is_active()) { if (profiler_is_active()) {
if (aProgress == JS::GC_CYCLE_END) { if (aProgress == JS::GC_CYCLE_END) {
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"GCMajor", "GCMajor",
MakeUnique<GCMajorMarkerPayload>(aDesc.startTime(aContext), MakeUnique<GCMajorMarkerPayload>(aDesc.startTime(aContext),
aDesc.endTime(aContext), aDesc.endTime(aContext),
aDesc.summaryToJSON(aContext))); aDesc.summaryToJSON(aContext)));
} else if (aProgress == JS::GC_SLICE_END) { } else if (aProgress == JS::GC_SLICE_END) {
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"GCSlice", "GCSlice",
MakeUnique<GCSliceMarkerPayload>(aDesc.lastSliceStart(aContext), MakeUnique<GCSliceMarkerPayload>(aDesc.lastSliceStart(aContext),
aDesc.lastSliceEnd(aContext), aDesc.lastSliceEnd(aContext),
@ -936,7 +936,7 @@ CycleCollectedJSRuntime::GCNurseryCollectionCallback(JSContext* aContext,
profiler_is_active()) profiler_is_active())
{ {
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
PROFILER_MARKER_PAYLOAD( profiler_add_marker(
"GCMinor", "GCMinor",
MakeUnique<GCMinorMarkerPayload>(self->mLatestNurseryCollectionStart, MakeUnique<GCMinorMarkerPayload>(self->mLatestNurseryCollectionStart,
TimeStamp::Now(), TimeStamp::Now(),

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

@ -986,7 +986,7 @@ ShutdownXPCOM(nsIServiceManager* aServMgr)
#endif #endif
nsCycleCollector_shutdown(shutdownCollect); nsCycleCollector_shutdown(shutdownCollect);
PROFILER_MARKER("Shutdown xpcom"); profiler_add_marker("Shutdown xpcom");
// If we are doing any shutdown checks, poison writes. // If we are doing any shutdown checks, poison writes.
if (gShutdownChecks != SCM_NOTHING) { if (gShutdownChecks != SCM_NOTHING) {
#ifdef XP_MACOSX #ifdef XP_MACOSX