Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 int64 total_pixels_rasterized = | 916 int64 total_pixels_rasterized = |
| 917 picture_pile->Raster(&canvas, rect, contents_scale); | 917 picture_pile->Raster(&canvas, rect, contents_scale); |
| 918 | 918 |
| 919 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 919 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
| 920 | 920 |
| 921 if (stats_instrumentation->record_rendering_stats()) { | 921 if (stats_instrumentation->record_rendering_stats()) { |
| 922 stats_instrumentation->AddRaster(duration, | 922 stats_instrumentation->AddRaster(duration, |
| 923 total_pixels_rasterized, | 923 total_pixels_rasterized, |
| 924 metadata.is_tile_in_pending_tree_now_bin); | 924 metadata.is_tile_in_pending_tree_now_bin); |
| 925 | 925 |
| 926 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", | 926 HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeUS", |
| 927 duration.InMilliseconds(), | 927 duration.InMicroseconds(), |
| 928 0, | 928 0, |
| 929 10, | 929 100000, |
| 930 10); | 930 100); |
| 931 | 931 |
| 932 if (metadata.prediction_benchmarking) { | 932 if (metadata.prediction_benchmarking) { |
| 933 PicturePileImpl::Analysis analysis; | 933 PicturePileImpl::Analysis analysis; |
| 934 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); | 934 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); |
| 935 bool is_predicted_cheap = analysis.is_cheap_to_raster; | 935 bool is_predicted_cheap = analysis.is_cheap_to_raster; |
| 936 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f; | 936 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f; |
| 937 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); | 937 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); |
| 938 | 938 |
| 939 DCHECK_EQ(bitmap.rowBytes(), | 939 DCHECK_EQ(bitmap.rowBytes(), |
| 940 static_cast<size_t>(bitmap.width() * bitmap.bytesPerPixel())); | 940 static_cast<size_t>(bitmap.width() * bitmap.bytesPerPixel())); |
| 941 | 941 |
| 942 RecordSolidColorPredictorResults( | 942 RecordSolidColorPredictorResults( |
| 943 reinterpret_cast<SkColor*>(bitmap.getPixels()), | 943 reinterpret_cast<SkColor*>(bitmap.getPixels()), |
| 944 bitmap.getSize() / bitmap.bytesPerPixel(), | 944 bitmap.getSize() / bitmap.bytesPerPixel(), |
| 945 analysis.is_solid_color, | 945 analysis.is_solid_color, |
| 946 analysis.solid_color, | 946 analysis.solid_color, |
| 947 analysis.is_transparent); | 947 analysis.is_transparent); |
| 948 } | 948 } |
| 949 } | 949 } |
| 950 } | 950 } |
| 951 | 951 |
| 952 // static | 952 // static |
| 953 void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap, | 953 void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap, |
| 954 bool is_actually_cheap) { | 954 bool is_actually_cheap) { |
| 955 if (is_predicted_cheap && !is_actually_cheap) | 955 if (is_predicted_cheap && !is_actually_cheap) |
| 956 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorBadlyWrong", true); | 956 HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorBadlyWrong", true); |
| 957 else if (!is_predicted_cheap && is_actually_cheap) | 957 else if (!is_predicted_cheap && is_actually_cheap) |
| 958 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorSafelyWrong", true); | 958 HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorSafelyWrong", true); |
| 959 | 959 |
| 960 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorAccuracy", | 960 HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorAccuracy", |
| 961 is_predicted_cheap == is_actually_cheap); | 961 is_predicted_cheap == is_actually_cheap); |
| 962 } | 962 } |
| 963 | 963 |
| 964 // static | 964 // static |
| 965 void TileManager::RecordSolidColorPredictorResults( | 965 void TileManager::RecordSolidColorPredictorResults( |
| 966 const SkColor* actual_colors, | 966 const SkColor* actual_colors, |
| 967 size_t color_count, | 967 size_t color_count, |
| 968 bool is_predicted_solid, | 968 bool is_predicted_solid, |
| 969 SkColor predicted_color, | 969 SkColor predicted_color, |
| 970 bool is_predicted_transparent) { | 970 bool is_predicted_transparent) { |
| 971 DCHECK_GT(color_count, 0u); | 971 DCHECK_GT(color_count, 0u); |
| 972 | 972 |
| 973 bool is_actually_solid = true; | 973 bool is_actually_solid = true; |
| 974 bool is_transparent = true; | 974 bool is_transparent = true; |
| 975 | 975 |
| 976 SkColor actual_color = *actual_colors; | 976 SkColor actual_color = *actual_colors; |
| 977 for (unsigned int i = 0; i < color_count; ++i) { | 977 for (unsigned int i = 0; i < color_count; ++i) { |
| 978 SkColor current_color = actual_colors[i]; | 978 SkColor current_color = actual_colors[i]; |
| 979 if (current_color != actual_color || | 979 if (current_color != actual_color || |
| 980 SkColorGetA(current_color) != 255) | 980 SkColorGetA(current_color) != 255) |
| 981 is_actually_solid = false; | 981 is_actually_solid = false; |
| 982 | 982 |
| 983 if (SkColorGetA(current_color) != 0) | 983 if (SkColorGetA(current_color) != 0) |
| 984 is_transparent = false; | 984 is_transparent = false; |
| 985 | 985 |
| 986 if (!is_actually_solid && !is_transparent) | 986 if (!is_actually_solid && !is_transparent) |
| 987 break; | 987 break; |
| 988 } | 988 } |
| 989 | 989 |
| 990 if (is_predicted_solid && !is_actually_solid) | 990 if (is_predicted_solid && !is_actually_solid) |
| 991 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualNotSolid", true); | 991 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualNotSolid", true); |
|
enne (OOO)
2013/04/04 20:42:09
I'm not sure I agree that making these not uma his
vmpstr
2013/04/04 20:53:19
These would only be recorded if both gpu-benchmark
| |
| 992 else if (is_predicted_solid && | 992 else if (is_predicted_solid && |
| 993 is_actually_solid && | 993 is_actually_solid && |
| 994 predicted_color != actual_color) | 994 predicted_color != actual_color) |
| 995 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongColor", true); | 995 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongColor", true); |
| 996 else if (!is_predicted_solid && is_actually_solid) | 996 else if (!is_predicted_solid && is_actually_solid) |
| 997 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualSolid", true); | 997 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualSolid", true); |
| 998 | 998 |
| 999 bool correct_guess = (is_predicted_solid && is_actually_solid && | 999 bool correct_guess = (is_predicted_solid && is_actually_solid && |
| 1000 predicted_color == actual_color) || | 1000 predicted_color == actual_color) || |
| 1001 (!is_predicted_solid && !is_actually_solid); | 1001 (!is_predicted_solid && !is_actually_solid); |
| 1002 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.Accuracy", correct_guess); | 1002 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.Accuracy", correct_guess); |
| 1003 | 1003 |
| 1004 if (correct_guess) | 1004 if (correct_guess) |
| 1005 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsCorrectSolid", | 1005 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsCorrectSolid", |
| 1006 is_predicted_solid); | 1006 is_predicted_solid); |
| 1007 | 1007 |
| 1008 if (is_predicted_transparent) | 1008 if (is_predicted_transparent) |
| 1009 UMA_HISTOGRAM_BOOLEAN( | 1009 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.PredictedTransparentIsActually", |
| 1010 "Renderer4.ColorPredictor.PredictedTransparentIsActually", | 1010 is_transparent); |
| 1011 is_transparent); | 1011 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsActuallyTransparent", |
| 1012 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsActuallyTransparent", | 1012 is_transparent); |
| 1013 is_transparent); | |
| 1014 } | 1013 } |
| 1015 | 1014 |
| 1016 // static | 1015 // static |
| 1017 void TileManager::RunImageDecodeTask( | 1016 void TileManager::RunImageDecodeTask( |
| 1018 skia::LazyPixelRef* pixel_ref, | 1017 skia::LazyPixelRef* pixel_ref, |
| 1019 RenderingStatsInstrumentation* stats_instrumentation) { | 1018 RenderingStatsInstrumentation* stats_instrumentation) { |
| 1020 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 1019 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
| 1021 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 1020 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
| 1022 pixel_ref->Decode(); | 1021 pixel_ref->Decode(); |
| 1023 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 1022 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
| 1024 stats_instrumentation->AddDeferredImageDecode(duration); | 1023 stats_instrumentation->AddDeferredImageDecode(duration); |
| 1025 } | 1024 } |
| 1026 | 1025 |
| 1027 } // namespace cc | 1026 } // namespace cc |
| OLD | NEW |