summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 08:20:16 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 08:20:16 +0000
commit8b6cea09a979ffb5e9d625cc2b3a4587c1929a32 (patch)
treec7afb93aa45f3cc6691660ab17f7a9496dc87e2c /cc
parentc27fdee9d2b32a33ce6f323a5d0ef4f28f5f7792 (diff)
downloadchromium_src-8b6cea09a979ffb5e9d625cc2b3a4587c1929a32.zip
chromium_src-8b6cea09a979ffb5e9d625cc2b3a4587c1929a32.tar.gz
chromium_src-8b6cea09a979ffb5e9d625cc2b3a4587c1929a32.tar.bz2
cc: Include analysis in raster benchmark costs
Insert analysis costs into the raster benchmark. This will make it possible to combine analysis and raster into a single step and be confident that it will not regress the total costs of rastering a tile. ATTN perf sheriffs: this will regress benchmarks because it is doing more work, but it is a more accurate representation of the work that gets done per unit of raster work. This should be treated as a "perf rebaseline" and not as a regression. R=vmpstr@chromium.org BUG=none Review URL: https://codereview.chromium.org/74713006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/debug/rasterize_and_record_benchmark_impl.cc3
-rw-r--r--cc/debug/rendering_stats.cc6
-rw-r--r--cc/debug/rendering_stats.h1
-rw-r--r--cc/debug/rendering_stats_instrumentation.cc9
-rw-r--r--cc/debug/rendering_stats_instrumentation.h1
-rw-r--r--cc/resources/picture_pile_impl.cc41
-rw-r--r--cc/resources/picture_pile_impl.h12
-rw-r--r--cc/resources/raster_worker_pool.cc3
8 files changed, 60 insertions, 16 deletions
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc
index ecf2688..f2904a3 100644
--- a/cc/debug/rasterize_and_record_benchmark_impl.cc
+++ b/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -94,8 +94,11 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {
SkBitmapDevice device(bitmap);
SkCanvas canvas(&device);
+ PicturePileImpl::Analysis analysis;
base::TimeTicks start = Now();
+ picture_pile->AnalyzeInRect(
+ content_rect, contents_scale, &analysis, NULL);
picture_pile->RasterToBitmap(&canvas, content_rect, contents_scale, NULL);
base::TimeTicks end = Now();
base::TimeDelta duration = end - start;
diff --git a/cc/debug/rendering_stats.cc b/cc/debug/rendering_stats.cc
index 16bf091..abce5ae 100644
--- a/cc/debug/rendering_stats.cc
+++ b/cc/debug/rendering_stats.cc
@@ -47,6 +47,7 @@ ImplThreadRenderingStats::AsTraceableData() const {
void ImplThreadRenderingStats::Add(const ImplThreadRenderingStats& other) {
frame_count += other.frame_count;
rasterize_time += other.rasterize_time;
+ analysis_time += other.analysis_time;
rasterized_pixel_count += other.rasterized_pixel_count;
}
@@ -61,8 +62,11 @@ void RenderingStats::EnumerateFields(Enumerator* enumerator) const {
main_stats.record_time.InSecondsF());
enumerator->AddInt64("recordedPixelCount",
main_stats.recorded_pixel_count);
+ // Combine rasterization and analysis time as a precursor to combining
+ // them in the same step internally.
enumerator->AddDouble("rasterizeTime",
- impl_stats.rasterize_time.InSecondsF());
+ impl_stats.rasterize_time.InSecondsF() +
+ impl_stats.analysis_time.InSecondsF());
enumerator->AddInt64("rasterizedPixelCount",
impl_stats.rasterized_pixel_count);
}
diff --git a/cc/debug/rendering_stats.h b/cc/debug/rendering_stats.h
index ff1dbef..d28f110 100644
--- a/cc/debug/rendering_stats.h
+++ b/cc/debug/rendering_stats.h
@@ -49,6 +49,7 @@ struct CC_EXPORT ImplThreadRenderingStats {
int64 frame_count;
base::TimeDelta rasterize_time;
+ base::TimeDelta analysis_time;
int64 rasterized_pixel_count;
ImplThreadRenderingStats();
diff --git a/cc/debug/rendering_stats_instrumentation.cc b/cc/debug/rendering_stats_instrumentation.cc
index 3987b7e..63840a3 100644
--- a/cc/debug/rendering_stats_instrumentation.cc
+++ b/cc/debug/rendering_stats_instrumentation.cc
@@ -99,4 +99,13 @@ void RenderingStatsInstrumentation::AddRaster(base::TimeDelta duration,
impl_stats_.rasterized_pixel_count += pixels;
}
+void RenderingStatsInstrumentation::AddAnalysis(base::TimeDelta duration,
+ int64 pixels) {
+ if (!record_rendering_stats_)
+ return;
+
+ base::AutoLock scoped_lock(lock_);
+ impl_stats_.analysis_time += duration;
+}
+
} // namespace cc
diff --git a/cc/debug/rendering_stats_instrumentation.h b/cc/debug/rendering_stats_instrumentation.h
index 4508600..6811755 100644
--- a/cc/debug/rendering_stats_instrumentation.h
+++ b/cc/debug/rendering_stats_instrumentation.h
@@ -52,6 +52,7 @@ class CC_EXPORT RenderingStatsInstrumentation {
void AddPaint(base::TimeDelta duration, int64 pixels);
void AddRecord(base::TimeDelta duration, int64 pixels);
void AddRaster(base::TimeDelta duration, int64 pixels);
+ void AddAnalysis(base::TimeDelta duration, int64 pixels);
protected:
RenderingStatsInstrumentation();
diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc
index 5522186..ca160b5 100644
--- a/cc/resources/picture_pile_impl.cc
+++ b/cc/resources/picture_pile_impl.cc
@@ -77,14 +77,17 @@ void PicturePileImpl::RasterDirect(
NULL,
canvas_rect,
contents_scale,
- rendering_stats_instrumentation);
+ rendering_stats_instrumentation,
+ false);
}
void PicturePileImpl::RasterForAnalysis(
skia::AnalysisCanvas* canvas,
gfx::Rect canvas_rect,
- float contents_scale) {
- RasterCommon(canvas, canvas, canvas_rect, contents_scale, NULL);
+ float contents_scale,
+ RenderingStatsInstrumentation* stats_instrumentation) {
+ RasterCommon(
+ canvas, canvas, canvas_rect, contents_scale, stats_instrumentation, true);
}
void PicturePileImpl::RasterToBitmap(
@@ -138,7 +141,8 @@ void PicturePileImpl::RasterToBitmap(
NULL,
canvas_rect,
contents_scale,
- rendering_stats_instrumentation);
+ rendering_stats_instrumentation,
+ false);
}
void PicturePileImpl::CoalesceRasters(gfx::Rect canvas_rect,
@@ -205,7 +209,8 @@ void PicturePileImpl::RasterCommon(
SkDrawPictureCallback* callback,
gfx::Rect canvas_rect,
float contents_scale,
- RenderingStatsInstrumentation* rendering_stats_instrumentation) {
+ RenderingStatsInstrumentation* rendering_stats_instrumentation,
+ bool is_analysis) {
DCHECK(contents_scale >= min_contents_scale_);
canvas->translate(-canvas_rect.x(), -canvas_rect.y());
@@ -261,8 +266,13 @@ void PicturePileImpl::RasterCommon(
}
if (rendering_stats_instrumentation) {
- rendering_stats_instrumentation->AddRaster(best_duration,
- rasterized_pixel_count);
+ if (is_analysis) {
+ rendering_stats_instrumentation->AddAnalysis(best_duration,
+ rasterized_pixel_count);
+ } else {
+ rendering_stats_instrumentation->AddRaster(best_duration,
+ rasterized_pixel_count);
+ }
}
}
@@ -298,9 +308,18 @@ skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() {
return picture;
}
-void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect,
- float contents_scale,
- PicturePileImpl::Analysis* analysis) {
+void PicturePileImpl::AnalyzeInRect(
+ gfx::Rect content_rect,
+ float contents_scale,
+ PicturePileImpl::Analysis* analysis) {
+ AnalyzeInRect(content_rect, contents_scale, analysis, NULL);
+}
+
+void PicturePileImpl::AnalyzeInRect(
+ gfx::Rect content_rect,
+ float contents_scale,
+ PicturePileImpl::Analysis* analysis,
+ RenderingStatsInstrumentation* stats_instrumentation) {
DCHECK(analysis);
TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect");
@@ -316,7 +335,7 @@ void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect,
skia::AnalysisDevice device(empty_bitmap);
skia::AnalysisCanvas canvas(&device);
- RasterForAnalysis(&canvas, layer_rect, 1.0f);
+ RasterForAnalysis(&canvas, layer_rect, 1.0f, stats_instrumentation);
analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color);
analysis->has_text = canvas.HasText();
diff --git a/cc/resources/picture_pile_impl.h b/cc/resources/picture_pile_impl.h
index 66b5f72..180dba2 100644
--- a/cc/resources/picture_pile_impl.h
+++ b/cc/resources/picture_pile_impl.h
@@ -57,8 +57,8 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
void RasterForAnalysis(
skia::AnalysisCanvas* canvas,
gfx::Rect canvas_rect,
- float contents_scale);
-
+ float contents_scale,
+ RenderingStatsInstrumentation* stats_instrumentation);
skia::RefPtr<SkPicture> GetFlattenedPicture();
@@ -75,6 +75,11 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
float contents_scale,
Analysis* analysis);
+ void AnalyzeInRect(gfx::Rect content_rect,
+ float contents_scale,
+ Analysis* analysis,
+ RenderingStatsInstrumentation* stats_instrumentation);
+
class CC_EXPORT PixelRefIterator {
public:
PixelRefIterator(gfx::Rect content_rect,
@@ -134,7 +139,8 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
SkDrawPictureCallback* callback,
gfx::Rect canvas_rect,
float contents_scale,
- RenderingStatsInstrumentation* rendering_stats_instrumentation);
+ RenderingStatsInstrumentation* rendering_stats_instrumentation,
+ bool is_analysis);
// Once instantiated, |clones_for_drawing_| can't be modified. This
// guarantees thread-safe access during the life time of a PicturePileImpl
diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc
index 67c548f..06fd18e 100644
--- a/cc/resources/raster_worker_pool.cc
+++ b/cc/resources/raster_worker_pool.cc
@@ -87,7 +87,8 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
DCHECK(picture_clone);
- picture_clone->AnalyzeInRect(content_rect_, contents_scale_, &analysis_);
+ picture_clone->AnalyzeInRect(
+ content_rect_, contents_scale_, &analysis_, rendering_stats_);
// Record the solid color prediction.
UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed",