Bug 1338347 - Record frame throughput ratio for APZ animations r=botond
MozReview-Commit-ID: 7Ljaya9RFeo
--- a/gfx/layers/composite/AnimationMetricsTracker.cpp
+++ b/gfx/layers/composite/AnimationMetricsTracker.cpp
@@ -14,16 +14,17 @@
namespace mozilla {
namespace layers {
AnimationMetricsTracker::AnimationMetricsTracker()
: mMaxLayerAreaAnimated(0)
, mChromeAnimationFrameCount(0)
, mContentAnimationFrameCount(0)
+ , mApzAnimationFrameCount(0)
{
}
AnimationMetricsTracker::~AnimationMetricsTracker()
{
}
void
@@ -57,16 +58,28 @@ AnimationMetricsTracker::UpdateAnimation
(aActive & AnimationProcessTypes::eContent) != AnimationProcessTypes::eNone,
mContentAnimationStart,
mContentAnimationFrameCount,
aVsyncInterval,
Telemetry::COMPOSITOR_ANIMATION_THROUGHPUT_CONTENT);
}
void
+AnimationMetricsTracker::UpdateApzAnimationInProgress(bool aInProgress,
+ TimeDuration aVsyncInterval)
+{
+ UpdateAnimationThroughput("apz",
+ aInProgress,
+ mApzAnimationStart,
+ mApzAnimationFrameCount,
+ aVsyncInterval,
+ Telemetry::COMPOSITOR_ANIMATION_THROUGHPUT_APZ);
+}
+
+void
AnimationMetricsTracker::AnimationStarted()
{
}
void
AnimationMetricsTracker::AnimationEnded()
{
MOZ_ASSERT(mCurrentAnimationStart);
--- a/gfx/layers/composite/AnimationMetricsTracker.h
+++ b/gfx/layers/composite/AnimationMetricsTracker.h
@@ -33,16 +33,22 @@ public:
* This function should be called per composite, to inform the metrics
* tracker which processes have active animations. If there is are animations
* in progress, the sum of their areas should also be provided, along with
* the vsync interval.
*/
void UpdateAnimationInProgress(AnimationProcessTypes aActive, uint64_t aLayerArea,
TimeDuration aVsyncInterval);
+ /**
+ * Similar to UpdateAnimationInProgress, but this is for APZ animations. Again,
+ * this should be called per composite.
+ */
+ void UpdateApzAnimationInProgress(bool aInProgress, TimeDuration aVsyncInterval);
+
private:
void AnimationStarted();
void AnimationEnded();
void UpdateAnimationThroughput(const char* aLabel,
bool aInProgress,
TimeStamp& aStartTime,
uint32_t& aFrameCount,
TimeDuration aVsyncInterval,
@@ -59,14 +65,18 @@ private:
// The start time of the current chrome-process animation.
TimeStamp mChromeAnimationStart;
// The number of frames composited for the current chrome-process animation.
uint32_t mChromeAnimationFrameCount;
// The start time of the current content-process animation.
TimeStamp mContentAnimationStart;
// The number of frames composited for the current content-process animation.
uint32_t mContentAnimationFrameCount;
+ // The start time of the current APZ animation.
+ TimeStamp mApzAnimationStart;
+ // The number of frames composited for the current APZ animation.
+ uint32_t mApzAnimationFrameCount;
};
} // namespace layers
} // namespace mozilla
#endif // mozilla_layers_AnimationMetricsTracker_h
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -1406,17 +1406,19 @@ AsyncCompositionManager::TransformShadow
// get it.
TimeStamp nextFrame = aCurrentFrame;
MOZ_ASSERT(aVsyncRate != TimeDuration::Forever());
if (aVsyncRate != TimeDuration::Forever()) {
nextFrame += aVsyncRate;
}
- wantNextFrame |= SampleAPZAnimations(LayerMetricsWrapper(root), nextFrame);
+ bool apzAnimating = SampleAPZAnimations(LayerMetricsWrapper(root), nextFrame);
+ mAnimationMetricsTracker.UpdateApzAnimationInProgress(apzAnimating, aVsyncRate);
+ wantNextFrame |= apzAnimating;
}
HostLayer* rootComposite = root->AsHostLayer();
gfx::Matrix4x4 trans = rootComposite->GetShadowBaseTransform();
trans *= gfx::Matrix4x4::From2D(mWorldTransform);
rootComposite->SetShadowBaseTransform(trans);