Bug 1107733. Integrate paint times into telemetry. r=mattwoodrow

This commit is contained in:
Mason Chang 2014-12-08 12:43:16 -08:00
parent 8b716a35b2
commit 75a72f02a0
3 changed files with 32 additions and 2 deletions

View File

@ -93,6 +93,7 @@
#include "nsFrameSelection.h" #include "nsFrameSelection.h"
#include "FrameLayerBuilder.h" #include "FrameLayerBuilder.h"
#include "mozilla/layers/APZCTreeManager.h" #include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/Telemetry.h"
#ifdef MOZ_XUL #ifdef MOZ_XUL
#include "nsXULPopupManager.h" #include "nsXULPopupManager.h"
@ -2892,6 +2893,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
return NS_OK; return NS_OK;
} }
TimeStamp startBuildDisplayList = TimeStamp::Now();
nsDisplayListBuilder builder(aFrame, nsDisplayListBuilder::PAINTING, nsDisplayListBuilder builder(aFrame, nsDisplayListBuilder::PAINTING,
!(aFlags & PAINT_HIDE_CARET)); !(aFlags & PAINT_HIDE_CARET));
@ -2911,7 +2913,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
if (aFlags & PAINT_WIDGET_LAYERS) { if (aFlags & PAINT_WIDGET_LAYERS) {
// This layer tree will be reused, so we'll need to calculate it // This layer tree will be reused, so we'll need to calculate it
// for the whole "visible" area of the window // for the whole "visible" area of the window
// //
// |ignoreViewportScrolling| and |usingDisplayPort| are persistent // |ignoreViewportScrolling| and |usingDisplayPort| are persistent
// document-rendering state. We rely on PresShell to flush // document-rendering state. We rely on PresShell to flush
// retained layers as needed when that persistent state changes. // retained layers as needed when that persistent state changes.
@ -3066,6 +3068,8 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
} }
builder.LeavePresShell(aFrame); builder.LeavePresShell(aFrame);
Telemetry::AccumulateTimeDelta(Telemetry::PAINT_BUILD_DISPLAYLIST_TIME,
startBuildDisplayList);
if (builder.GetHadToIgnorePaintSuppression()) { if (builder.GetHadToIgnorePaintSuppression()) {
willFlushRetainedLayers = true; willFlushRetainedLayers = true;
@ -3132,8 +3136,11 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
flags |= nsDisplayList::PAINT_COMPRESSED; flags |= nsDisplayList::PAINT_COMPRESSED;
} }
TimeStamp paintStart = TimeStamp::Now();
nsRefPtr<LayerManager> layerManager = nsRefPtr<LayerManager> layerManager =
list.PaintRoot(&builder, aRenderingContext, flags); list.PaintRoot(&builder, aRenderingContext, flags);
Telemetry::AccumulateTimeDelta(Telemetry::PAINT_RASTERIZE_TIME,
paintStart);
#ifdef MOZ_DUMP_PAINTING #ifdef MOZ_DUMP_PAINTING
if (gfxUtils::DumpPaintList() || gfxUtils::sDumpPainting) { if (gfxUtils::DumpPaintList() || gfxUtils::sDumpPainting) {

View File

@ -1180,7 +1180,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
while (etor.HasMore()) { while (etor.HasMore()) {
nsRefPtr<nsARefreshObserver> obs = etor.GetNext(); nsRefPtr<nsARefreshObserver> obs = etor.GetNext();
obs->WillRefresh(aNowTime); obs->WillRefresh(aNowTime);
if (!mPresContext || !mPresContext->GetPresShell()) { if (!mPresContext || !mPresContext->GetPresShell()) {
StopTimer(); StopTimer();
return; return;
@ -1386,6 +1386,8 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
} }
} }
mozilla::Telemetry::AccumulateTimeDelta(mozilla::Telemetry::REFRESH_DRIVER_TICK, mTickStart);
for (uint32_t i = 0; i < mPostRefreshObservers.Length(); ++i) { for (uint32_t i = 0; i < mPostRefreshObservers.Length(); ++i) {
mPostRefreshObservers[i]->DidRefresh(); mPostRefreshObservers[i]->DidRefresh();
} }

View File

@ -2168,6 +2168,27 @@
"n_buckets": 20, "n_buckets": 20,
"description": "The number of unusable addresses reported for each record" "description": "The number of unusable addresses reported for each record"
}, },
"REFRESH_DRIVER_TICK" : {
"expires_in_version": "never",
"description": "Total time spent ticking the refresh driver in milliseconds",
"kind": "exponential",
"high": "1000",
"n_buckets": 50
},
"PAINT_BUILD_DISPLAYLIST_TIME" : {
"expires_in_version": "never",
"description": "Time spent in building displaylists in milliseconds",
"kind": "exponential",
"high": "1000",
"n_buckets": 50
},
"PAINT_RASTERIZE_TIME" : {
"expires_in_version": "never",
"description": "Time spent rasterizing each frame in milliseconds",
"kind": "exponential",
"high": "1000",
"n_buckets": 50
},
"PREDICTOR_PREDICT_ATTEMPTS": { "PREDICTOR_PREDICT_ATTEMPTS": {
"expires_in_version": "never", "expires_in_version": "never",
"kind": "exponential", "kind": "exponential",