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

Unified Diff: cc/tile_manager.cc

Issue 11575015: adding render stats for deferred image decoding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tile_manager.h ('k') | tools/perf/perf_tools/smoothness_benchmark.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tile_manager.cc
diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
index 06b5090ccfcf5407a7a4bfc2ab7641dd42b4d263..4255c799c82e77135022c33283ac2886c637f571 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -69,11 +69,12 @@ class RasterThread : public base::Thread {
void PostImageDecodingTaskAndReply(const tracked_objects::Location& from_here,
skia::LazyPixelRef* pixel_ref,
+ RenderingStats* stats,
const base::Closure& reply) {
++num_pending_tasks_;
message_loop_proxy()->PostTaskAndReply(
from_here,
- base::Bind(&RunImageDecodeTask, base::Unretained(pixel_ref)),
+ base::Bind(&RunImageDecodeTask, pixel_ref, stats),
base::Bind(&RasterThread::RunReply, base::Unretained(this), reply));
}
@@ -98,9 +99,13 @@ class RasterThread : public base::Thread {
stats);
}
- static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref) {
+ static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref,
+ RenderingStats* stats) {
TRACE_EVENT0("cc", "RasterThread::RunImageDecodeTask");
+ base::TimeTicks decodeBeginTime = base::TimeTicks::Now();
pixel_ref->Decode();
+ stats->totalDeferredImageDecodeTimeInSeconds +=
+ (base::TimeTicks::Now() - decodeBeginTime).InSecondsF();
}
void RunReply(const base::Closure& reply) {
@@ -329,8 +334,17 @@ void TileManager::CheckForCompletedSetPixels() {
void TileManager::renderingStats(RenderingStats* stats) {
stats->totalRasterizeTimeInSeconds =
- rendering_stats_.totalRasterizeTimeInSeconds;
+ rendering_stats_.totalRasterizeTimeInSeconds;
stats->totalPixelsRasterized = rendering_stats_.totalPixelsRasterized;
+ stats->totalDeferredImageDecodeCount =
+ rendering_stats_.totalDeferredImageDecodeCount;
+ stats->totalDeferredImageCacheHitCount =
+ rendering_stats_.totalDeferredImageCacheHitCount;
+ stats->totalPixelGatheringCount = rendering_stats_.totalPixelGatheringCount;
+ stats->totalDeferredImageDecodeTimeInSeconds =
+ rendering_stats_.totalDeferredImageDecodeTimeInSeconds;
+ stats->totalPixelGatheringTimeInSeconds =
+ rendering_stats_.totalPixelGatheringTimeInSeconds;
}
void TileManager::AssignGpuMemoryToTiles() {
@@ -455,8 +469,12 @@ void TileManager::DispatchImageDecodingTasksForTile(Tile* tile) {
if (managed_state.need_to_gather_pixel_refs) {
TRACE_EVENT0("cc",
"TileManager::DispatchImageDecodingTaskForTile: Gather PixelRefs");
+ base::TimeTicks gatherBeginTime = base::TimeTicks::Now();
const_cast<PicturePileImpl *>(tile->picture_pile())->GatherPixelRefs(
tile->content_rect_, managed_state.pending_pixel_refs);
+ rendering_stats_.totalPixelGatheringCount++;
+ rendering_stats_.totalPixelGatheringTimeInSeconds +=
+ (base::TimeTicks::Now() - gatherBeginTime).InSecondsF();
managed_state.need_to_gather_pixel_refs = false;
}
@@ -471,11 +489,13 @@ void TileManager::DispatchImageDecodingTasksForTile(Tile* tile) {
}
// TODO(qinmin): passing correct image size to PrepareToDecode().
if ((*it)->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) {
+ rendering_stats_.totalDeferredImageCacheHitCount++;
pending_pixel_refs.erase(it++);
} else {
RasterThread* thread = GetFreeRasterThread();
- if (thread)
- DispatchOneImageDecodingTask(thread, tile, *it);
+ if (!thread)
+ return;
+ DispatchOneImageDecodingTask(thread, tile, *it);
++it;
}
}
@@ -489,21 +509,27 @@ void TileManager::DispatchOneImageDecodingTask(RasterThread* thread,
DCHECK(pending_decode_tasks_.end() ==
pending_decode_tasks_.find(pixel_ref_id));
pending_decode_tasks_[pixel_ref_id] = pixel_ref;
+ RenderingStats* stats = new RenderingStats();
reveman 2012/12/13 20:55:13 you need to delete this instance in OnImageDecodin
qinmin 2012/12/13 21:09:25 ah...I forgot that.. Done. On 2012/12/13 20:55:13
thread->PostImageDecodingTaskAndReply(
FROM_HERE,
pixel_ref,
+ stats,
base::Bind(&TileManager::OnImageDecodingTaskCompleted,
base::Unretained(this),
tile,
- pixel_ref_id));
+ pixel_ref_id,
+ stats));
}
void TileManager::OnImageDecodingTaskCompleted(scoped_refptr<Tile> tile,
- uint32_t pixel_ref_id) {
+ uint32_t pixel_ref_id,
+ RenderingStats* stats) {
TRACE_EVENT0("cc", "TileManager::OnImageDecoded");
pending_decode_tasks_.erase(pixel_ref_id);
-
+ rendering_stats_.totalDeferredImageDecodeTimeInSeconds +=
+ stats->totalDeferredImageDecodeTimeInSeconds;
+ rendering_stats_.totalDeferredImageDecodeCount++;
for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin();
it != tiles_with_image_decoding_tasks_.end(); ++it) {
std::list<skia::LazyPixelRef*>& pixel_refs =
« no previous file with comments | « cc/tile_manager.h ('k') | tools/perf/perf_tools/smoothness_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698