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

Side by Side Diff: cc/tile_manager.cc

Issue 12192025: Add cheapness predictor success histogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tile_manager.h" 5 #include "cc/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 650
651 ResourceProvider::ResourceId resource_id = resource->id(); 651 ResourceProvider::ResourceId resource_id = resource->id();
652 652
653 if (use_cheapness_estimator_ && 653 if (use_cheapness_estimator_ &&
654 tile->picture_pile()->IsCheapInRect(tile->content_rect_, 654 tile->picture_pile()->IsCheapInRect(tile->content_rect_,
655 tile->contents_scale())) { 655 tile->contents_scale())) {
656 RunRasterTask(resource_pool_->resource_provider()->mapPixelBuffer( 656 RunRasterTask(resource_pool_->resource_provider()->mapPixelBuffer(
657 resource_id), 657 resource_id),
658 tile->content_rect_, 658 tile->content_rect_,
659 tile->contents_scale(), 659 tile->contents_scale(),
660 use_cheapness_estimator_,
660 tile->picture_pile(), 661 tile->picture_pile(),
661 &rendering_stats_); 662 &rendering_stats_);
662 TileManager::OnRasterTaskCompleted(tile, resource.Pass(), 663 TileManager::OnRasterTaskCompleted(tile, resource.Pass(),
663 manage_tiles_call_count_); 664 manage_tiles_call_count_);
664 return; 665 return;
665 } 666 }
666 667
667 raster_worker_pool_->PostRasterTaskAndReply( 668 raster_worker_pool_->PostRasterTaskAndReply(
668 tile->picture_pile(), 669 tile->picture_pile(),
669 base::Bind(&TileManager::RunRasterTask, 670 base::Bind(&TileManager::RunRasterTask,
670 resource_pool_->resource_provider()->mapPixelBuffer( 671 resource_pool_->resource_provider()->mapPixelBuffer(
671 resource_id), 672 resource_id),
672 tile->content_rect_, 673 tile->content_rect_,
673 tile->contents_scale()), 674 tile->contents_scale(),
675 use_cheapness_estimator_),
674 base::Bind(&TileManager::OnRasterTaskCompletedByWorker, 676 base::Bind(&TileManager::OnRasterTaskCompletedByWorker,
675 base::Unretained(this), 677 base::Unretained(this),
676 tile, 678 tile,
677 base::Passed(&resource), 679 base::Passed(&resource),
678 manage_tiles_call_count_)); 680 manage_tiles_call_count_));
679 } 681 }
680 682
681 void TileManager::OnRasterTaskCompleted( 683 void TileManager::OnRasterTaskCompleted(
682 scoped_refptr<Tile> tile, 684 scoped_refptr<Tile> tile,
683 scoped_ptr<ResourcePool::Resource> resource, 685 scoped_ptr<ResourcePool::Resource> resource,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // Increment count for new bin. 771 // Increment count for new bin.
770 ++raster_state_count_[mts.raster_state][tree][bin]; 772 ++raster_state_count_[mts.raster_state][tree][bin];
771 773
772 mts.tree_bin[tree] = bin; 774 mts.tree_bin[tree] = bin;
773 } 775 }
774 776
775 // static 777 // static
776 void TileManager::RunRasterTask(uint8* buffer, 778 void TileManager::RunRasterTask(uint8* buffer,
777 const gfx::Rect& rect, 779 const gfx::Rect& rect,
778 float contents_scale, 780 float contents_scale,
781 bool use_cheapness_estimator,
779 PicturePileImpl* picture_pile, 782 PicturePileImpl* picture_pile,
780 RenderingStats* stats) { 783 RenderingStats* stats) {
781 TRACE_EVENT0("cc", "TileManager::RunRasterTask"); 784 TRACE_EVENT0("cc", "TileManager::RunRasterTask");
782 DCHECK(picture_pile); 785 DCHECK(picture_pile);
783 DCHECK(buffer); 786 DCHECK(buffer);
784 SkBitmap bitmap; 787 SkBitmap bitmap;
785 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height()); 788 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height());
786 bitmap.setPixels(buffer); 789 bitmap.setPixels(buffer);
787 SkDevice device(bitmap); 790 SkDevice device(bitmap);
788 SkCanvas canvas(&device); 791 SkCanvas canvas(&device);
789 792
790 base::TimeTicks begin_time; 793 base::TimeTicks begin_time;
791 if (stats) 794 if (stats)
792 begin_time = base::TimeTicks::Now(); 795 begin_time = base::TimeTicks::Now();
793 796
794 picture_pile->Raster(&canvas, rect, contents_scale, stats); 797 picture_pile->Raster(&canvas, rect, contents_scale, stats);
795 798
796 if (stats) { 799 if (stats) {
797 base::TimeTicks end_time = base::TimeTicks::Now(); 800 base::TimeTicks end_time = base::TimeTicks::Now();
nduca 2013/02/04 23:16:52 now that i look at this, didn't we already collect
798 base::TimeDelta duration = end_time - begin_time; 801 base::TimeDelta duration = end_time - begin_time;
799 stats->totalRasterizeTime += duration; 802 stats->totalRasterizeTime += duration;
800 UMA_HISTOGRAM_CUSTOM_COUNTS( 803 UMA_HISTOGRAM_CUSTOM_COUNTS(
801 "Renderer4.PictureRasterTimeMS", 804 "Renderer4.PictureRasterTimeMS",
802 duration.InMilliseconds(), 805 duration.InMilliseconds(),
803 0, 10, 10 806 0, 10, 10
804 ); 807 );
808
809 if (use_cheapness_estimator) {
810 bool is_cheap = picture_pile->IsCheapInRect (rect, contents_scale);
811 bool is_correct_estimate = false;
812
813 // Cheap means less than 1ms
814 if ((is_cheap && duration.InMillisecondsF() <= 1.0f) ||
815 (!is_cheap && duration.InMillisecondsF() > 1.0f))
816 is_correct_estimate = true;
817
818 UMA_HISTOGRAM_BOOLEAN(
819 "Renderer4.CheapnessPredictorAccuracy",
820 is_correct_estimate
821 );
822 }
805 } 823 }
806 } 824 }
807 825
808 // static 826 // static
809 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, 827 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref,
810 RenderingStats* stats) { 828 RenderingStats* stats) {
811 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); 829 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask");
812 base::TimeTicks decode_begin_time; 830 base::TimeTicks decode_begin_time;
813 if (stats) 831 if (stats)
814 decode_begin_time = base::TimeTicks::Now(); 832 decode_begin_time = base::TimeTicks::Now();
815 pixel_ref->Decode(); 833 pixel_ref->Decode();
816 if (stats) { 834 if (stats) {
817 stats->totalDeferredImageDecodeCount++; 835 stats->totalDeferredImageDecodeCount++;
818 stats->totalDeferredImageDecodeTime += 836 stats->totalDeferredImageDecodeTime +=
819 base::TimeTicks::Now() - decode_begin_time; 837 base::TimeTicks::Now() - decode_begin_time;
820 } 838 }
821 } 839 }
822 840
823 } // namespace cc 841 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698