зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1897752 - Clean up layout telemetry. r=smaug
This telemetry was trying to measure three things: * The time spent during style / layout in a tick. This is useful. * The times SetNeed{Style,Layout} flush have been called. This is not a particularly useful metric, there's not much to learn or change from it. Any call is basically free as long as they're consecutive / there's no flush in between. * The number of times layout / style has been flushed during a tick. This is more useful than the above but, similarly, there's not too much to be learned here. Number of flushes can be completely orthogonal to how expensive it has been. It also had a number of flaws: * It is recorded per-PresShell, so we get multiple pings per tick. * Similarly, if a sub-frame dies before the tick, we just never report that time. Instead, refactor it to make it simpler, and just record the first metric reliably. This simplifies the code substantially, and I don't think we're losing much. The histograms are also expired. We might want to renew this, I'll file a follow-up to either properly renew this if we plan to look at it, or remove the code entirely from the tree. Differential Revision: https://phabricator.services.mozilla.com/D210907
This commit is contained in:
Родитель
4b6ff158ec
Коммит
98e394c703
|
@ -7,12 +7,22 @@
|
|||
#include "mozilla/layout/LayoutTelemetryTools.h"
|
||||
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/EnumeratedRange.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layout_telemetry;
|
||||
namespace mozilla::layout_telemetry {
|
||||
|
||||
using LayoutSubsystemDurations =
|
||||
EnumeratedArray<LayoutSubsystem, double, size_t(LayoutSubsystem::Count)>;
|
||||
|
||||
struct PerTickData {
|
||||
constexpr PerTickData() = default;
|
||||
LayoutSubsystemDurations mLayoutSubsystemDurationMs;
|
||||
};
|
||||
|
||||
static PerTickData sData;
|
||||
static AutoRecord* sCurrentRecord;
|
||||
|
||||
// Returns the key name expected by telemetry. Keep to date with
|
||||
// toolkits/components/telemetry/Histograms.json.
|
||||
|
@ -35,83 +45,12 @@ static nsLiteralCString SubsystemTelemetryKey(LayoutSubsystem aSubsystem) {
|
|||
}
|
||||
}
|
||||
|
||||
static AutoRecord* sCurrentRecord;
|
||||
|
||||
static FlushKind ToKind(FlushType aFlushType) {
|
||||
switch (aFlushType) {
|
||||
default:
|
||||
MOZ_CRASH("Expected FlushType::Style or FlushType::Layout");
|
||||
case FlushType::Style:
|
||||
return FlushKind::Style;
|
||||
case FlushType::Layout:
|
||||
return FlushKind::Layout;
|
||||
}
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace layout_telemetry {
|
||||
|
||||
Data::Data() {
|
||||
PodZero(&mReqsPerFlush);
|
||||
PodZero(&mFlushesPerTick);
|
||||
PodZero(&mLayoutSubsystemDurationMs);
|
||||
}
|
||||
|
||||
void Data::IncReqsPerFlush(FlushType aFlushType) {
|
||||
mReqsPerFlush[ToKind(aFlushType)]++;
|
||||
}
|
||||
|
||||
void Data::IncFlushesPerTick(FlushType aFlushType) {
|
||||
mFlushesPerTick[ToKind(aFlushType)]++;
|
||||
}
|
||||
|
||||
void Data::PingReqsPerFlushTelemetry(FlushType aFlushType) {
|
||||
auto flushKind = ToKind(aFlushType);
|
||||
if (flushKind == FlushKind::Layout) {
|
||||
auto styleFlushReqs = mReqsPerFlush[FlushKind::Style].value();
|
||||
auto layoutFlushReqs = mReqsPerFlush[FlushKind::Layout].value();
|
||||
Telemetry::Accumulate(Telemetry::PRESSHELL_REQS_PER_LAYOUT_FLUSH,
|
||||
"Style"_ns, styleFlushReqs);
|
||||
Telemetry::Accumulate(Telemetry::PRESSHELL_REQS_PER_LAYOUT_FLUSH,
|
||||
"Layout"_ns, layoutFlushReqs);
|
||||
mReqsPerFlush[FlushKind::Style] = SaturateUint8(0);
|
||||
mReqsPerFlush[FlushKind::Layout] = SaturateUint8(0);
|
||||
} else {
|
||||
auto styleFlushReqs = mReqsPerFlush[FlushKind::Style].value();
|
||||
Telemetry::Accumulate(Telemetry::PRESSHELL_REQS_PER_STYLE_FLUSH,
|
||||
styleFlushReqs);
|
||||
mReqsPerFlush[FlushKind::Style] = SaturateUint8(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Data::PingFlushPerTickTelemetry(FlushType aFlushType) {
|
||||
auto flushKind = ToKind(aFlushType);
|
||||
auto styleFlushes = mFlushesPerTick[FlushKind::Style].value();
|
||||
if (styleFlushes > 0) {
|
||||
Telemetry::Accumulate(Telemetry::PRESSHELL_FLUSHES_PER_TICK, "Style"_ns,
|
||||
styleFlushes);
|
||||
mFlushesPerTick[FlushKind::Style] = SaturateUint8(0);
|
||||
}
|
||||
|
||||
auto layoutFlushes = mFlushesPerTick[FlushKind::Layout].value();
|
||||
if (flushKind == FlushKind::Layout && layoutFlushes > 0) {
|
||||
Telemetry::Accumulate(Telemetry::PRESSHELL_FLUSHES_PER_TICK, "Layout"_ns,
|
||||
layoutFlushes);
|
||||
mFlushesPerTick[FlushKind::Layout] = SaturateUint8(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Data::PingTotalMsPerTickTelemetry(FlushType aFlushType) {
|
||||
auto flushKind = ToKind(aFlushType);
|
||||
auto range = (flushKind == FlushKind::Style)
|
||||
? MakeEnumeratedRange(LayoutSubsystem::Restyle,
|
||||
LayoutSubsystem::Reflow)
|
||||
: MakeEnumeratedRange(LayoutSubsystem::Reflow,
|
||||
LayoutSubsystem::Count);
|
||||
|
||||
void PingPerTickTelemetry() {
|
||||
auto range =
|
||||
MakeEnumeratedRange(LayoutSubsystem::Restyle, LayoutSubsystem::Count);
|
||||
for (auto subsystem : range) {
|
||||
auto key = SubsystemTelemetryKey(subsystem);
|
||||
double& duration = mLayoutSubsystemDurationMs[subsystem];
|
||||
double& duration = sData.mLayoutSubsystemDurationMs[subsystem];
|
||||
if (duration > 0.0) {
|
||||
Telemetry::Accumulate(Telemetry::PRESSHELL_LAYOUT_TOTAL_MS_PER_TICK, key,
|
||||
static_cast<uint32_t>(duration));
|
||||
|
@ -120,31 +59,16 @@ void Data::PingTotalMsPerTickTelemetry(FlushType aFlushType) {
|
|||
}
|
||||
}
|
||||
|
||||
void Data::PingPerTickTelemetry(FlushType aFlushType) {
|
||||
PingFlushPerTickTelemetry(aFlushType);
|
||||
PingTotalMsPerTickTelemetry(aFlushType);
|
||||
}
|
||||
|
||||
AutoRecord::AutoRecord(LayoutSubsystem aSubsystem)
|
||||
: AutoRecord(nullptr, aSubsystem) {}
|
||||
|
||||
AutoRecord::AutoRecord(Data* aLayoutTelemetry, LayoutSubsystem aSubsystem)
|
||||
: mParentRecord(sCurrentRecord),
|
||||
mLayoutTelemetry(aLayoutTelemetry),
|
||||
mSubsystem(aSubsystem),
|
||||
mStartTime(TimeStamp::Now()),
|
||||
mDurationMs(0.0) {
|
||||
: mParentRecord(sCurrentRecord), mSubsystem(aSubsystem) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// If we're re-entering the same subsystem, don't update the current record.
|
||||
if (mParentRecord && mParentRecord->mSubsystem == mSubsystem) {
|
||||
return;
|
||||
}
|
||||
|
||||
mStartTime = TimeStamp::Now();
|
||||
if (mParentRecord) {
|
||||
if (mParentRecord->mSubsystem == mSubsystem) {
|
||||
return;
|
||||
}
|
||||
|
||||
mLayoutTelemetry = mParentRecord->mLayoutTelemetry;
|
||||
MOZ_ASSERT(mLayoutTelemetry);
|
||||
|
||||
// If we're entering a new subsystem, record the amount of time spent in the
|
||||
// parent record before setting the new current record.
|
||||
mParentRecord->mDurationMs +=
|
||||
|
@ -162,7 +86,7 @@ AutoRecord::~AutoRecord() {
|
|||
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
mDurationMs += (now - mStartTime).ToMilliseconds();
|
||||
mLayoutTelemetry->mLayoutSubsystemDurationMs[mSubsystem] += mDurationMs;
|
||||
sData.mLayoutSubsystemDurationMs[mSubsystem] += mDurationMs;
|
||||
|
||||
if (mParentRecord) {
|
||||
// Restart the parent recording from this point
|
||||
|
@ -173,5 +97,4 @@ AutoRecord::~AutoRecord() {
|
|||
sCurrentRecord = mParentRecord;
|
||||
}
|
||||
|
||||
} // namespace layout_telemetry
|
||||
} // namespace mozilla
|
||||
} // namespace mozilla::layout_telemetry
|
||||
|
|
|
@ -9,23 +9,16 @@
|
|||
#ifndef mozilla_LayoutTelemetryTools_h
|
||||
#define mozilla_LayoutTelemetryTools_h
|
||||
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/EnumeratedRange.h"
|
||||
#include "mozilla/FlushType.h"
|
||||
#include "mozilla/Saturate.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
#define LAYOUT_TELEMETRY_RECORD(subsystem) \
|
||||
layout_telemetry::AutoRecord a(layout_telemetry::LayoutSubsystem::subsystem)
|
||||
mozilla::layout_telemetry::AutoRecord a( \
|
||||
mozilla::layout_telemetry::LayoutSubsystem::subsystem)
|
||||
|
||||
#define LAYOUT_TELEMETRY_RECORD_BASE(subsystem) \
|
||||
layout_telemetry::AutoRecord a(&mLayoutTelemetry, \
|
||||
layout_telemetry::LayoutSubsystem::subsystem)
|
||||
namespace mozilla::layout_telemetry {
|
||||
|
||||
namespace mozilla {
|
||||
namespace layout_telemetry {
|
||||
|
||||
enum class FlushKind : uint8_t { Style, Layout, Count };
|
||||
// Send the current per-tick telemetry.
|
||||
void PingPerTickTelemetry();
|
||||
|
||||
enum class LayoutSubsystem : uint8_t {
|
||||
Restyle,
|
||||
|
@ -37,54 +30,18 @@ enum class LayoutSubsystem : uint8_t {
|
|||
Count
|
||||
};
|
||||
|
||||
using LayoutSubsystemDurations =
|
||||
EnumeratedArray<LayoutSubsystem, double, size_t(LayoutSubsystem::Count)>;
|
||||
using LayoutFlushCount =
|
||||
EnumeratedArray<FlushKind, SaturateUint8, size_t(FlushKind::Count)>;
|
||||
|
||||
struct Data {
|
||||
Data();
|
||||
|
||||
void IncReqsPerFlush(FlushType aFlushType);
|
||||
void IncFlushesPerTick(FlushType aFlushType);
|
||||
|
||||
void PingTelemetry();
|
||||
|
||||
// Send the current number of flush requests for aFlushType to telemetry and
|
||||
// reset the count.
|
||||
void PingReqsPerFlushTelemetry(FlushType aFlushType);
|
||||
|
||||
// Send the current non-zero number of style and layout flushes to telemetry
|
||||
// and reset the count.
|
||||
void PingFlushPerTickTelemetry(FlushType aFlushType);
|
||||
|
||||
// Send the current non-zero time spent under style and layout processing this
|
||||
// tick to telemetry and reset the total.
|
||||
void PingTotalMsPerTickTelemetry(FlushType aFlushType);
|
||||
|
||||
// Send the current per-tick telemetry for `aFlushType`.
|
||||
void PingPerTickTelemetry(FlushType aFlushType);
|
||||
|
||||
LayoutFlushCount mReqsPerFlush;
|
||||
LayoutFlushCount mFlushesPerTick;
|
||||
LayoutSubsystemDurations mLayoutSubsystemDurationMs;
|
||||
};
|
||||
|
||||
class AutoRecord {
|
||||
public:
|
||||
explicit AutoRecord(LayoutSubsystem aSubsystem);
|
||||
AutoRecord(Data* aLayoutTelemetry, LayoutSubsystem aSubsystem);
|
||||
~AutoRecord();
|
||||
|
||||
private:
|
||||
AutoRecord* mParentRecord;
|
||||
Data* mLayoutTelemetry;
|
||||
LayoutSubsystem mSubsystem;
|
||||
AutoRecord* const mParentRecord;
|
||||
const LayoutSubsystem mSubsystem;
|
||||
TimeStamp mStartTime;
|
||||
double mDurationMs;
|
||||
double mDurationMs = 0.0;
|
||||
};
|
||||
|
||||
} // namespace layout_telemetry
|
||||
} // namespace mozilla
|
||||
} // namespace mozilla::layout_telemetry
|
||||
|
||||
#endif // !mozilla_LayoutTelemetryTools_h
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/CaretAssociationHint.h"
|
||||
#include "mozilla/ContentIterator.h"
|
||||
#include "mozilla/css/ImageLoader.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/layout/LayoutTelemetryTools.h"
|
||||
#include "mozilla/dom/AncestorIterator.h"
|
||||
#include "mozilla/dom/BrowserBridgeChild.h"
|
||||
#include "mozilla/dom/BrowserChild.h"
|
||||
|
@ -4299,144 +4299,117 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) {
|
|||
MOZ_DIAGNOSTIC_ASSERT(mIsDestroying || mViewManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIsDestroying || mDocument->HasShellOrBFCacheEntry());
|
||||
|
||||
if (!isSafeToFlush) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the view manager stays alive.
|
||||
RefPtr<nsViewManager> viewManager = mViewManager;
|
||||
bool didStyleFlush = false;
|
||||
bool didLayoutFlush = false;
|
||||
if (isSafeToFlush) {
|
||||
// We need to make sure external resource documents are flushed too (for
|
||||
// example, svg filters that reference a filter in an external document
|
||||
// need the frames in the external document to be constructed for the
|
||||
// filter to work). We only need external resources to be flushed when the
|
||||
// main document is flushing >= FlushType::Frames, so we flush external
|
||||
// resources here instead of Document::FlushPendingNotifications.
|
||||
mDocument->FlushExternalResources(flushType);
|
||||
// We need to make sure external resource documents are flushed too (for
|
||||
// example, svg filters that reference a filter in an external document
|
||||
// need the frames in the external document to be constructed for the
|
||||
// filter to work). We only need external resources to be flushed when the
|
||||
// main document is flushing >= FlushType::Frames, so we flush external
|
||||
// resources here instead of Document::FlushPendingNotifications.
|
||||
mDocument->FlushExternalResources(flushType);
|
||||
|
||||
// Force flushing of any pending content notifications that might have
|
||||
// queued up while our event was pending. That will ensure that we don't
|
||||
// construct frames for content right now that's still waiting to be
|
||||
// notified on,
|
||||
mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
|
||||
// Force flushing of any pending content notifications that might have
|
||||
// queued up while our event was pending. That will ensure that we don't
|
||||
// construct frames for content right now that's still waiting to be
|
||||
// notified on,
|
||||
mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
|
||||
|
||||
mDocument->UpdateSVGUseElementShadowTrees();
|
||||
mDocument->UpdateSVGUseElementShadowTrees();
|
||||
|
||||
// Process pending restyles, since any flush of the presshell wants
|
||||
// up-to-date style data.
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
viewManager->FlushDelayedResize();
|
||||
mPresContext->FlushPendingMediaFeatureValuesChanged();
|
||||
// Process pending restyles, since any flush of the presshell wants
|
||||
// up-to-date style data.
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
viewManager->FlushDelayedResize();
|
||||
mPresContext->FlushPendingMediaFeatureValuesChanged();
|
||||
}
|
||||
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
// Now that we have flushed media queries, update the rules before looking
|
||||
// up @font-face / @counter-style / @font-feature-values rules.
|
||||
StyleSet()->UpdateStylistIfNeeded();
|
||||
|
||||
// Flush any pending update of the user font set, since that could
|
||||
// cause style changes (for updating ex/ch units, and to cause a
|
||||
// reflow).
|
||||
mDocument->FlushUserFontSet();
|
||||
|
||||
mPresContext->FlushCounterStyles();
|
||||
|
||||
mPresContext->FlushFontFeatureValues();
|
||||
|
||||
mPresContext->FlushFontPaletteValues();
|
||||
|
||||
// Flush any requested SMIL samples.
|
||||
if (mDocument->HasAnimationController()) {
|
||||
mDocument->GetAnimationController()->FlushResampleRequests();
|
||||
}
|
||||
}
|
||||
|
||||
// The FlushResampleRequests() above might have flushed style changes.
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
if (aFlush.mFlushAnimations) {
|
||||
mPresContext->EffectCompositor()->PostRestyleForThrottledAnimations();
|
||||
mNeedThrottledAnimationFlush = false;
|
||||
}
|
||||
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
// Now that we have flushed media queries, update the rules before looking
|
||||
// up @font-face / @counter-style / @font-feature-values rules.
|
||||
StyleSet()->UpdateStylistIfNeeded();
|
||||
|
||||
// Flush any pending update of the user font set, since that could
|
||||
// cause style changes (for updating ex/ch units, and to cause a
|
||||
// reflow).
|
||||
mDocument->FlushUserFontSet();
|
||||
|
||||
mPresContext->FlushCounterStyles();
|
||||
|
||||
mPresContext->FlushFontFeatureValues();
|
||||
|
||||
mPresContext->FlushFontPaletteValues();
|
||||
|
||||
// Flush any requested SMIL samples.
|
||||
if (mDocument->HasAnimationController()) {
|
||||
mDocument->GetAnimationController()->FlushResampleRequests();
|
||||
}
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
Maybe<uint64_t> innerWindowID;
|
||||
if (auto* window = mDocument->GetInnerWindow()) {
|
||||
innerWindowID = Some(window->WindowID());
|
||||
}
|
||||
AutoProfilerStyleMarker tracingStyleFlush(std::move(mStyleCause),
|
||||
innerWindowID);
|
||||
PerfStats::AutoMetricRecording<PerfStats::Metric::Styling> autoRecording;
|
||||
LAYOUT_TELEMETRY_RECORD(Restyle);
|
||||
|
||||
// The FlushResampleRequests() above might have flushed style changes.
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
if (aFlush.mFlushAnimations) {
|
||||
mPresContext->EffectCompositor()->PostRestyleForThrottledAnimations();
|
||||
mNeedThrottledAnimationFlush = false;
|
||||
}
|
||||
mPresContext->RestyleManager()->ProcessPendingRestyles();
|
||||
mNeedStyleFlush = false;
|
||||
}
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
Maybe<uint64_t> innerWindowID;
|
||||
if (auto* window = mDocument->GetInnerWindow()) {
|
||||
innerWindowID = Some(window->WindowID());
|
||||
}
|
||||
AutoProfilerStyleMarker tracingStyleFlush(std::move(mStyleCause),
|
||||
innerWindowID);
|
||||
PerfStats::AutoMetricRecording<PerfStats::Metric::Styling> autoRecording;
|
||||
LAYOUT_TELEMETRY_RECORD_BASE(Restyle);
|
||||
AssertFrameTreeIsSane(*this);
|
||||
|
||||
mPresContext->RestyleManager()->ProcessPendingRestyles();
|
||||
mNeedStyleFlush = false;
|
||||
}
|
||||
|
||||
AssertFrameTreeIsSane(*this);
|
||||
|
||||
didStyleFlush = true;
|
||||
|
||||
if (flushType >= (SuppressInterruptibleReflows()
|
||||
? FlushType::Layout
|
||||
: FlushType::InterruptibleLayout) &&
|
||||
!mIsDestroying) {
|
||||
didLayoutFlush = true;
|
||||
if (DoFlushLayout(/* aInterruptible = */ flushType < FlushType::Layout)) {
|
||||
if (flushType >= (SuppressInterruptibleReflows()
|
||||
? FlushType::Layout
|
||||
: FlushType::InterruptibleLayout) &&
|
||||
!mIsDestroying) {
|
||||
if (DoFlushLayout(/* aInterruptible = */ flushType < FlushType::Layout)) {
|
||||
if (mContentToScrollTo) {
|
||||
DoScrollContentIntoView();
|
||||
if (mContentToScrollTo) {
|
||||
DoScrollContentIntoView();
|
||||
if (mContentToScrollTo) {
|
||||
mContentToScrollTo->RemoveProperty(nsGkAtoms::scrolling);
|
||||
mContentToScrollTo = nullptr;
|
||||
}
|
||||
mContentToScrollTo->RemoveProperty(nsGkAtoms::scrolling);
|
||||
mContentToScrollTo = nullptr;
|
||||
}
|
||||
}
|
||||
// FIXME(emilio): Maybe we should assert here but it's not 100% sure it'd
|
||||
// hold right now, UnsuppressAndInvalidate and so on can run script...
|
||||
if (MOZ_LIKELY(mDirtyRoots.IsEmpty())) {
|
||||
mNeedLayoutFlush = false;
|
||||
}
|
||||
}
|
||||
|
||||
FlushPendingScrollResnap();
|
||||
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
// Try to trigger pending scroll-driven animations after we flush
|
||||
// style and layout (if any). If we try to trigger them after flushing
|
||||
// style but the frame tree is not ready, we will check them again after
|
||||
// we flush layout because the requirement to trigger scroll-driven
|
||||
// animations is that the associated scroll containers are ready (i.e. the
|
||||
// scroll-timeline is active), and this depends on the readiness of the
|
||||
// scrollable frame and the primary frame of the scroll container.
|
||||
TriggerPendingScrollTimelineAnimations(mDocument);
|
||||
}
|
||||
|
||||
if (flushType >= FlushType::Layout) {
|
||||
if (!mIsDestroying) {
|
||||
viewManager->UpdateWidgetGeometry();
|
||||
}
|
||||
// FIXME(emilio): Maybe we should assert here but it's not 100% sure it'd
|
||||
// hold right now, UnsuppressAndInvalidate and so on can run script...
|
||||
if (MOZ_LIKELY(mDirtyRoots.IsEmpty())) {
|
||||
mNeedLayoutFlush = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Update flush counters
|
||||
if (didStyleFlush) {
|
||||
mLayoutTelemetry.IncReqsPerFlush(FlushType::Style);
|
||||
FlushPendingScrollResnap();
|
||||
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
// Try to trigger pending scroll-driven animations after we flush
|
||||
// style and layout (if any). If we try to trigger them after flushing
|
||||
// style but the frame tree is not ready, we will check them again after
|
||||
// we flush layout because the requirement to trigger scroll-driven
|
||||
// animations is that the associated scroll containers are ready (i.e. the
|
||||
// scroll-timeline is active), and this depends on the readiness of the
|
||||
// scrollable frame and the primary frame of the scroll container.
|
||||
TriggerPendingScrollTimelineAnimations(mDocument);
|
||||
}
|
||||
|
||||
if (didLayoutFlush) {
|
||||
mLayoutTelemetry.IncReqsPerFlush(FlushType::Layout);
|
||||
}
|
||||
|
||||
// Record telemetry for the number of requests per each flush type.
|
||||
//
|
||||
// Flushes happen as style or style+layout. This depends upon the `flushType`
|
||||
// where flushType >= InterruptibleLayout means flush layout and flushType >=
|
||||
// Style means flush style. We only report if didLayoutFlush or didStyleFlush
|
||||
// is true because we care if a flush really did take place. (Flush is guarded
|
||||
// by `isSafeToFlush == true`.)
|
||||
if (flushType >= FlushType::InterruptibleLayout && didLayoutFlush) {
|
||||
MOZ_ASSERT(didLayoutFlush == didStyleFlush);
|
||||
mLayoutTelemetry.PingReqsPerFlushTelemetry(FlushType::Layout);
|
||||
} else if (flushType >= FlushType::Style && didStyleFlush) {
|
||||
MOZ_ASSERT(!didLayoutFlush);
|
||||
mLayoutTelemetry.PingReqsPerFlushTelemetry(FlushType::Style);
|
||||
if (flushType >= FlushType::Layout) {
|
||||
if (!mIsDestroying) {
|
||||
viewManager->UpdateWidgetGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9739,7 +9712,7 @@ bool PresShell::DoReflow(nsIFrame* target, bool aInterruptible,
|
|||
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING_RELEVANT_FOR_JS(
|
||||
"Reflow", LAYOUT_Reflow, uri ? uri->GetSpecOrDefault() : "N/A"_ns);
|
||||
|
||||
LAYOUT_TELEMETRY_RECORD_BASE(Reflow);
|
||||
LAYOUT_TELEMETRY_RECORD(Reflow);
|
||||
|
||||
PerfStats::AutoMetricRecording<PerfStats::Metric::Reflowing> autoRecording;
|
||||
|
||||
|
@ -12096,10 +12069,6 @@ void PresShell::EndPaint() {
|
|||
}
|
||||
}
|
||||
|
||||
void PresShell::PingPerTickTelemetry(FlushType aFlushType) {
|
||||
mLayoutTelemetry.PingPerTickTelemetry(aFlushType);
|
||||
}
|
||||
|
||||
bool PresShell::GetZoomableByAPZ() const {
|
||||
return mZoomConstraintsClient && mZoomConstraintsClient->GetAllowZoom();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "mozilla/dom/DocumentBinding.h"
|
||||
#include "mozilla/FlushType.h"
|
||||
#include "mozilla/layers/FocusTarget.h"
|
||||
#include "mozilla/layout/LayoutTelemetryTools.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/PresShellForwards.h"
|
||||
|
@ -27,7 +26,6 @@
|
|||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/widget/ThemeChangeKind.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCoord.h"
|
||||
|
@ -2925,11 +2923,6 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
nsIFrame* mCurrentReflowRoot = nullptr;
|
||||
#endif // #ifdef DEBUG
|
||||
|
||||
// Send, and reset, the current per tick telemetry. This includes:
|
||||
// * non-zero number of style and layout flushes
|
||||
// * non-zero ms duration spent in style and reflow since the last tick.
|
||||
void PingPerTickTelemetry(FlushType aFlushType);
|
||||
|
||||
private:
|
||||
// IMPORTANT: The ownership implicit in the following member variables
|
||||
// has been explicitly checked. If you add any members to this class,
|
||||
|
@ -3254,8 +3247,6 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
static bool sDisableNonTestMouseEvents;
|
||||
|
||||
static bool sProcessInteractable;
|
||||
|
||||
layout_telemetry::Data mLayoutTelemetry;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(PresShell, NS_PRESSHELL_IID)
|
||||
|
|
|
@ -26,8 +26,6 @@ void PresShell::SetNeedLayoutFlush() {
|
|||
if (!mReflowCause) {
|
||||
mReflowCause = profiler_capture_backtrace();
|
||||
}
|
||||
|
||||
mLayoutTelemetry.IncReqsPerFlush(FlushType::Layout);
|
||||
}
|
||||
|
||||
void PresShell::SetNeedStyleFlush() {
|
||||
|
@ -48,8 +46,6 @@ void PresShell::SetNeedStyleFlush() {
|
|||
if (!mStyleCause) {
|
||||
mStyleCause = profiler_capture_backtrace();
|
||||
}
|
||||
|
||||
mLayoutTelemetry.IncReqsPerFlush(FlushType::Layout);
|
||||
}
|
||||
|
||||
void PresShell::EnsureStyleFlush() {
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/layout/LayoutTelemetryTools.h"
|
||||
#include "mozilla/dom/MediaQueryList.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/InputTaskManager.h"
|
||||
|
@ -2250,9 +2250,6 @@ void nsRefreshDriver::FlushLayoutOnPendingDocsAndFixUpFocus() {
|
|||
// promise if it needs to.
|
||||
presShell->NotifyFontFaceSetOnRefresh();
|
||||
mNeedToRecomputeVisibility = true;
|
||||
|
||||
// Record the telemetry for events that occurred between ticks.
|
||||
presShell->PingPerTickTelemetry(FlushType::Layout);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2767,6 +2764,8 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime,
|
|||
|
||||
UpdateAnimatedImages(previousRefresh, aNowTime);
|
||||
|
||||
layout_telemetry::PingPerTickTelemetry();
|
||||
|
||||
bool dispatchTasksAfterTick = false;
|
||||
if (mViewManagerFlushIsPending && !mThrottled) {
|
||||
nsCString transactionId;
|
||||
|
|
|
@ -16755,43 +16755,6 @@
|
|||
"keyed": true,
|
||||
"description": "How many milliseconds it took before 100 wakeups for the thread was done because of new Runnables."
|
||||
},
|
||||
"PRESSHELL_REQS_PER_STYLE_FLUSH": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec"],
|
||||
"alert_emails": ["layout-telemetry-alerts@mozilla.com"],
|
||||
"bug_numbers": [1571612, 1616147],
|
||||
"expires_in_version": "82",
|
||||
"kind": "exponential",
|
||||
"high": 256,
|
||||
"n_buckets": 32,
|
||||
"description": "The number of style flush requests pending per style flush."
|
||||
},
|
||||
"PRESSHELL_REQS_PER_LAYOUT_FLUSH": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec"],
|
||||
"alert_emails": ["layout-telemetry-alerts@mozilla.com"],
|
||||
"bug_numbers": [1571612, 1616147],
|
||||
"expires_in_version": "82",
|
||||
"keyed": true,
|
||||
"keys": ["Style", "Layout"],
|
||||
"kind": "exponential",
|
||||
"high": 256,
|
||||
"n_buckets": 32,
|
||||
"description": "The number of style flush requests and layout flush requests pending per layout flush. Both values are recorded because flushing a pending layout flush also flushes style."
|
||||
},
|
||||
"PRESSHELL_FLUSHES_PER_TICK": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec"],
|
||||
"alert_emails": ["layout-telemetry-alerts@mozilla.com"],
|
||||
"bug_numbers": [1571612, 1616147],
|
||||
"expires_in_version": "82",
|
||||
"keyed": true,
|
||||
"keys": ["Style", "Layout"],
|
||||
"kind": "exponential",
|
||||
"high": 256,
|
||||
"n_buckets": 32,
|
||||
"description": "The number of style and layout flushes that occur per Refresh Driver tick."
|
||||
},
|
||||
"PRESSHELL_LAYOUT_TOTAL_MS_PER_TICK": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec"],
|
||||
|
|
Загрузка…
Ссылка в новой задаче