summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorqinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 05:14:40 +0000
committerqinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 05:14:40 +0000
commit6200cb5ce385a6dc7404d80277b0398eda8bfdf5 (patch)
tree8213967dc8878273f75df578c30f69cf02ce7123 /cc
parent7215d13eb317ffbe51cdb36bd43cdf7b83c90c16 (diff)
downloadchromium_src-6200cb5ce385a6dc7404d80277b0398eda8bfdf5.zip
chromium_src-6200cb5ce385a6dc7404d80277b0398eda8bfdf5.tar.gz
chromium_src-6200cb5ce385a6dc7404d80277b0398eda8bfdf5.tar.bz2
adding render stats for deferred image decoding
BUG=163980 Review URL: https://chromiumcodereview.appspot.com/11575015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/rendering_stats.cc16
-rw-r--r--cc/rendering_stats.h5
-rw-r--r--cc/tile_manager.cc69
-rw-r--r--cc/tile_manager.h5
4 files changed, 69 insertions, 26 deletions
diff --git a/cc/rendering_stats.cc b/cc/rendering_stats.cc
index 530efbf..cf524e4 100644
--- a/cc/rendering_stats.cc
+++ b/cc/rendering_stats.cc
@@ -19,7 +19,12 @@ RenderingStats::RenderingStats()
numImplThreadScrolls(0),
numMainThreadScrolls(0),
numLayersDrawn(0),
- numMissingTiles(0) {
+ numMissingTiles(0),
+ totalDeferredImageDecodeCount(0),
+ totalDeferredImageCacheHitCount(0),
+ totalImageGatheringCount(0),
+ totalDeferredImageDecodeTimeInSeconds(0),
+ totalImageGatheringTimeInSeconds(0) {
}
void RenderingStats::EnumerateFields(Enumerator* enumerator) const {
@@ -37,6 +42,15 @@ void RenderingStats::EnumerateFields(Enumerator* enumerator) const {
enumerator->AddInt64("numMainThreadScrolls", numMainThreadScrolls);
enumerator->AddInt64("numLayersDrawn", numLayersDrawn);
enumerator->AddInt64("numMissingTiles", numMissingTiles);
+ enumerator->AddInt64("totalDeferredImageDecodeCount",
+ totalDeferredImageDecodeCount);
+ enumerator->AddInt64("totalDeferredImageCacheHitCount",
+ totalDeferredImageCacheHitCount);
+ enumerator->AddInt64("totalImageGatheringCount", totalImageGatheringCount);
+ enumerator->AddDouble("totalDeferredImageDecodeTimeInSeconds",
+ totalDeferredImageDecodeTimeInSeconds);
+ enumerator->AddDouble("totalImageGatheringTimeInSeconds",
+ totalImageGatheringTimeInSeconds);
}
} // namespace cc
diff --git a/cc/rendering_stats.h b/cc/rendering_stats.h
index 3eafa80..9424f55 100644
--- a/cc/rendering_stats.h
+++ b/cc/rendering_stats.h
@@ -26,6 +26,11 @@ struct CC_EXPORT RenderingStats {
int64 numMainThreadScrolls;
int64 numLayersDrawn;
int64 numMissingTiles;
+ int64 totalDeferredImageDecodeCount;
+ int64 totalDeferredImageCacheHitCount;
+ int64 totalImageGatheringCount;
+ double totalDeferredImageDecodeTimeInSeconds;
+ double totalImageGatheringTimeInSeconds;
// Note: when adding new members, please remember to update enumerateFields
// in rendering_stats.cc.
diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
index f3921df..ecd1500 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) {
@@ -343,8 +348,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->totalImageGatheringCount = rendering_stats_.totalImageGatheringCount;
+ stats->totalDeferredImageDecodeTimeInSeconds =
+ rendering_stats_.totalDeferredImageDecodeTimeInSeconds;
+ stats->totalImageGatheringTimeInSeconds =
+ rendering_stats_.totalImageGatheringTimeInSeconds;
}
void TileManager::AssignGpuMemoryToTiles() {
@@ -363,13 +377,9 @@ void TileManager::AssignGpuMemoryToTiles() {
tiles_that_need_to_be_rasterized_.begin(),
tiles_that_need_to_be_rasterized_.end());
- // Record all the tiles in the image decoding list. A tile will not be
- // inserted to the rasterizer queue if it is waiting for image decoding.
- std::set<Tile*> image_decoding_tile_set;
- for (std::list<Tile*>::iterator it = tiles_with_image_decoding_tasks_.begin();
- it != tiles_with_image_decoding_tasks_.end(); ++it) {
- image_decoding_tile_set.insert(*it);
- }
+ // Reset the image decoding list so that we don't mess up with tile
+ // priorities. Tiles will be added to the image decoding list again
+ // when DispatchMoreTasks() is called.
tiles_with_image_decoding_tasks_.clear();
size_t bytes_left = global_state_.memory_limit_in_bytes - unreleasable_bytes;
@@ -392,12 +402,8 @@ void TileManager::AssignGpuMemoryToTiles() {
bytes_left -= tile_bytes;
managed_tile_state.can_use_gpu_memory = true;
if (!managed_tile_state.resource &&
- !managed_tile_state.resource_is_being_initialized) {
- if (image_decoding_tile_set.end() != image_decoding_tile_set.find(tile))
- tiles_with_image_decoding_tasks_.push_back(tile);
- else
- tiles_that_need_to_be_rasterized_.push_back(tile);
- }
+ !managed_tile_state.resource_is_being_initialized)
+ tiles_that_need_to_be_rasterized_.push_back(tile);
}
// Reverse two tiles_that_need_* vectors such that pop_back gets
@@ -464,16 +470,22 @@ void TileManager::DispatchMoreTasks() {
}
}
-void TileManager::DispatchImageDecodingTasksForTile(Tile* tile) {
+void TileManager::GatherPixelRefsForFile(Tile* tile) {
+ TRACE_EVENT0("cc", "TileManager::GatherPixelRefsForFile");
ManagedTileState& managed_state = tile->managed_state();
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_.totalImageGatheringCount++;
+ rendering_stats_.totalImageGatheringTimeInSeconds +=
+ (base::TimeTicks::Now() - gatherBeginTime).InSecondsF();
managed_state.need_to_gather_pixel_refs = false;
}
+}
+void TileManager::DispatchImageDecodingTasksForTile(Tile* tile) {
+ GatherPixelRefsForFile(tile);
std::list<skia::LazyPixelRef*>& pending_pixel_refs =
tile->managed_state().pending_pixel_refs;
std::list<skia::LazyPixelRef*>::iterator it = pending_pixel_refs.begin();
@@ -485,11 +497,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;
}
}
@@ -503,21 +517,28 @@ 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();
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++;
+ delete stats;
for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin();
it != tiles_with_image_decoding_tasks_.end(); ++it) {
std::list<skia::LazyPixelRef*>& pixel_refs =
diff --git a/cc/tile_manager.h b/cc/tile_manager.h
index d80e2f1..cc140c499 100644
--- a/cc/tile_manager.h
+++ b/cc/tile_manager.h
@@ -104,9 +104,12 @@ class CC_EXPORT TileManager {
RenderingStats*);
void DidFinishTileInitialization(Tile*);
void DispatchImageDecodingTasksForTile(Tile*);
- void OnImageDecodingTaskCompleted(scoped_refptr<Tile>, uint32_t);
+ void OnImageDecodingTaskCompleted(scoped_refptr<Tile>,
+ uint32_t,
+ RenderingStats*);
void DispatchOneImageDecodingTask(
RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*);
+ void GatherPixelRefsForFile(Tile*);
RasterThread* GetFreeRasterThread();
TileManagerClient* client_;