Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: cc/resources/raster_worker_pool.cc

Issue 25353009: telemetry: Refactored rasterize_and_record measurement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made BenchmarkInstrumentation a class. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/raster_worker_pool.h" 5 #include "cc/resources/raster_worker_pool.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/debug/benchmark_instrumentation.h"
11 #include "cc/debug/devtools_instrumentation.h" 10 #include "cc/debug/devtools_instrumentation.h"
12 #include "cc/debug/traced_value.h" 11 #include "cc/debug/traced_value.h"
13 #include "cc/resources/picture_pile_impl.h" 12 #include "cc/resources/picture_pile_impl.h"
14 #include "skia/ext/lazy_pixel_ref.h" 13 #include "skia/ext/lazy_pixel_ref.h"
15 #include "skia/ext/paint_simplifier.h" 14 #include "skia/ext/paint_simplifier.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
17 16
18 namespace cc { 17 namespace cc {
19 18
20 namespace { 19 namespace {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 95
97 // Clear the flag if we're not using the estimator. 96 // Clear the flag if we're not using the estimator.
98 analysis_.is_solid_color &= kUseColorEstimator; 97 analysis_.is_solid_color &= kUseColorEstimator;
99 } 98 }
100 99
101 bool RunRasterOnThread(unsigned thread_index, 100 bool RunRasterOnThread(unsigned thread_index,
102 void* buffer, 101 void* buffer,
103 gfx::Size size, 102 gfx::Size size,
104 int stride) { 103 int stride) {
105 TRACE_EVENT2( 104 TRACE_EVENT2(
106 benchmark_instrumentation::kCategory, 105 "cc", "RasterWorkerPoolTaskImpl::RunRasterOnThread",
107 benchmark_instrumentation::kRunRasterOnThread, 106 "data",
108 benchmark_instrumentation::kData,
109 TracedValue::FromValue(DataAsValue().release()), 107 TracedValue::FromValue(DataAsValue().release()),
110 "raster_mode", 108 "raster_mode",
111 TracedValue::FromValue(RasterModeAsValue(raster_mode_).release())); 109 TracedValue::FromValue(RasterModeAsValue(raster_mode_).release()));
112 110
113 devtools_instrumentation::ScopedLayerTask raster_task( 111 devtools_instrumentation::ScopedLayerTask raster_task(
114 devtools_instrumentation::kRasterTask, layer_id_); 112 devtools_instrumentation::kRasterTask, layer_id_);
115 113
116 DCHECK(picture_pile_.get()); 114 DCHECK(picture_pile_.get());
117 DCHECK(buffer); 115 DCHECK(buffer);
118 116
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 case HIGH_QUALITY_RASTER_MODE: 157 case HIGH_QUALITY_RASTER_MODE:
160 break; 158 break;
161 case NUM_RASTER_MODES: 159 case NUM_RASTER_MODES:
162 default: 160 default:
163 NOTREACHED(); 161 NOTREACHED();
164 } 162 }
165 163
166 canvas.setDrawFilter(draw_filter.get()); 164 canvas.setDrawFilter(draw_filter.get());
167 165
168 base::TimeDelta prev_rasterize_time = 166 base::TimeDelta prev_rasterize_time =
169 rendering_stats_->GetImplThreadRenderingStats().rasterize_time; 167 rendering_stats_->impl_thread_rendering_stats().rasterize_time;
170 168
171 picture_clone->RasterToBitmap( 169 // Only record rasterization time for highres tiles, because
172 &canvas, content_rect_, contents_scale_, rendering_stats_); 170 // lowres tiles are not required for activation and therefore
171 // introduce noise in the measurement (sometimes they get rasterized
172 // before we draw and sometimes they aren't)
173 if (tile_resolution_ == HIGH_RESOLUTION) {
174 picture_clone->RasterToBitmap(
175 &canvas, content_rect_, contents_scale_, rendering_stats_);
176 } else {
177 picture_clone->RasterToBitmap(
178 &canvas, content_rect_, contents_scale_, NULL);
179 }
173 180
174 if (rendering_stats_->record_rendering_stats()) { 181 if (rendering_stats_->record_rendering_stats()) {
175 base::TimeDelta current_rasterize_time = 182 base::TimeDelta current_rasterize_time =
176 rendering_stats_->GetImplThreadRenderingStats().rasterize_time; 183 rendering_stats_->impl_thread_rendering_stats().rasterize_time;
177 HISTOGRAM_CUSTOM_COUNTS( 184 HISTOGRAM_CUSTOM_COUNTS(
178 "Renderer4.PictureRasterTimeUS", 185 "Renderer4.PictureRasterTimeUS",
179 (current_rasterize_time - prev_rasterize_time).InMicroseconds(), 186 (current_rasterize_time - prev_rasterize_time).InMicroseconds(),
180 0, 187 0,
181 100000, 188 100000,
182 100); 189 100);
183 } 190 }
184 191
185 ChangeBitmapConfigIfNeeded(bitmap, buffer); 192 ChangeBitmapConfigIfNeeded(bitmap, buffer);
186 193
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 586
580 internal::GraphNode* decode_node = CreateGraphNodeForTask( 587 internal::GraphNode* decode_node = CreateGraphNodeForTask(
581 decode_task, priority, graph); 588 decode_task, priority, graph);
582 decode_node->add_dependent(raster_node); 589 decode_node->add_dependent(raster_node);
583 } 590 }
584 591
585 return raster_node; 592 return raster_node;
586 } 593 }
587 594
588 } // namespace cc 595 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698