зеркало из https://github.com/mozilla/gecko-dev.git
Compositor performance warnings
--HG-- extra : rebase_source : e8b2a0f4c4cb69fb88a478750cecc9f21327e018
This commit is contained in:
Родитель
56fb439aab
Коммит
fb686d4091
|
@ -140,9 +140,16 @@ CompositorParent::ScheduleComposition()
|
|||
if (!initialComposition)
|
||||
delta = mozilla::TimeStamp::Now() - mLastCompose;
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
mExpectedComposeTime = mozilla::TimeStamp::Now() + TimeDuration::FromMilliseconds(15);
|
||||
#endif
|
||||
|
||||
printf_stderr("Schedule composition\n");
|
||||
mCurrentCompositeTask = NewRunnableMethod(this, &CompositorParent::Composite);
|
||||
if (!initialComposition && delta.ToMilliseconds() < 15) {
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
mExpectedComposeTime = mozilla::TimeStamp::Now() + TimeDuration::FromMilliseconds(15 - delta.ToMilliseconds());
|
||||
#endif
|
||||
MessageLoop::current()->PostDelayedTask(FROM_HERE, mCurrentCompositeTask, 15 - delta.ToMilliseconds());
|
||||
} else {
|
||||
MessageLoop::current()->PostTask(FROM_HERE, mCurrentCompositeTask);
|
||||
|
@ -162,6 +169,8 @@ CompositorParent::Composite()
|
|||
{
|
||||
mCurrentCompositeTask = NULL;
|
||||
|
||||
mLastCompose = mozilla::TimeStamp::Now();
|
||||
|
||||
if (mPaused || !mLayerManager) {
|
||||
return;
|
||||
}
|
||||
|
@ -188,7 +197,13 @@ CompositorParent::Composite()
|
|||
#endif
|
||||
|
||||
mLayerManager->EndEmptyTransaction();
|
||||
mLastCompose = mozilla::TimeStamp::Now();
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
if (mExpectedComposeTime + TimeDuration::FromMilliseconds(15) < mozilla::TimeStamp::Now()) {
|
||||
printf_stderr("Compositor: Compose frame took %i time then expected.\n",
|
||||
(int)(mozilla::TimeStamp::Now() - mExpectedComposeTime).ToMilliseconds());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
|
|
@ -41,6 +41,14 @@
|
|||
#ifndef mozilla_layers_CompositorParent_h
|
||||
#define mozilla_layers_CompositorParent_h
|
||||
|
||||
// Enable this pref to turn on compositor performance warning.
|
||||
// This will print warnings if the compositor isn't meeting
|
||||
// it's responsiveness objectives:
|
||||
// 1) Compose a frame within 15ms of receiving a ScheduleCompositeCall
|
||||
// 2) Unless a frame was composited within the throttle threshold in
|
||||
// which the deadline will be 15ms + throttle threshold
|
||||
#define COMPOSITOR_PERFORMANCE_WARNING
|
||||
|
||||
#include "mozilla/layers/PCompositorParent.h"
|
||||
#include "mozilla/layers/PLayersParent.h"
|
||||
#include "base/thread.h"
|
||||
|
@ -129,6 +137,9 @@ private:
|
|||
nsIWidget* mWidget;
|
||||
CancelableTask *mCurrentCompositeTask;
|
||||
TimeStamp mLastCompose;
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
TimeStamp mExpectedComposeTime;
|
||||
#endif
|
||||
|
||||
bool mPaused;
|
||||
float mXScale;
|
||||
|
|
|
@ -149,6 +149,10 @@ bool
|
|||
ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
InfallibleTArray<EditReply>* reply)
|
||||
{
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
TimeStamp updateStart = TimeStamp::Now();
|
||||
#endif
|
||||
|
||||
MOZ_LAYERS_LOG(("[ParentSide] received txn with %d edits", cset.Length()));
|
||||
|
||||
if (mDestroyed || layer_manager()->IsDestroyed()) {
|
||||
|
@ -385,6 +389,11 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||
|
||||
mShadowLayersManager->ShadowLayersUpdated();
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
printf_stderr("Compositor: Layers update took %i ms (blocking gecko).\n",
|
||||
(int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds());
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче