| OLD | NEW |
| 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/debug/rasterize_and_record_benchmark.h" | 5 #include "cc/debug/rasterize_and_record_benchmark.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 const int kDefaultRecordRepeatCount = 100; | 32 const int kDefaultRecordRepeatCount = 100; |
| 33 | 33 |
| 34 // Parameters for LapTimer. | 34 // Parameters for LapTimer. |
| 35 const int kTimeLimitMillis = 1; | 35 const int kTimeLimitMillis = 1; |
| 36 const int kWarmupRuns = 0; | 36 const int kWarmupRuns = 0; |
| 37 const int kTimeCheckInterval = 1; | 37 const int kTimeCheckInterval = 1; |
| 38 | 38 |
| 39 const char* kModeSuffixes[DisplayListRecordingSource::RECORDING_MODE_COUNT] = { | 39 const char* kModeSuffixes[DisplayListRecordingSource::RECORDING_MODE_COUNT] = { |
| 40 "", "_sk_null_canvas", "_painting_disabled", "_caching_disabled", | 40 "", |
| 41 "_construction_disabled"}; | 41 "_sk_null_canvas", |
| 42 "_painting_disabled", |
| 43 "_caching_disabled", |
| 44 "_construction_disabled", |
| 45 "_subsequence_caching_disabled"}; |
| 42 | 46 |
| 43 } // namespace | 47 } // namespace |
| 44 | 48 |
| 45 RasterizeAndRecordBenchmark::RasterizeAndRecordBenchmark( | 49 RasterizeAndRecordBenchmark::RasterizeAndRecordBenchmark( |
| 46 scoped_ptr<base::Value> value, | 50 scoped_ptr<base::Value> value, |
| 47 const MicroBenchmark::DoneCallback& callback) | 51 const MicroBenchmark::DoneCallback& callback) |
| 48 : MicroBenchmark(callback), | 52 : MicroBenchmark(callback), |
| 49 record_repeat_count_(kDefaultRecordRepeatCount), | 53 record_repeat_count_(kDefaultRecordRepeatCount), |
| 50 settings_(std::move(value)), | 54 settings_(std::move(value)), |
| 51 main_thread_benchmark_done_(false), | 55 main_thread_benchmark_done_(false), |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 case DisplayListRecordingSource::RECORD_WITH_PAINTING_DISABLED: | 137 case DisplayListRecordingSource::RECORD_WITH_PAINTING_DISABLED: |
| 134 painting_control = ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED; | 138 painting_control = ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED; |
| 135 break; | 139 break; |
| 136 case DisplayListRecordingSource::RECORD_WITH_CACHING_DISABLED: | 140 case DisplayListRecordingSource::RECORD_WITH_CACHING_DISABLED: |
| 137 painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED; | 141 painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED; |
| 138 break; | 142 break; |
| 139 case DisplayListRecordingSource::RECORD_WITH_CONSTRUCTION_DISABLED: | 143 case DisplayListRecordingSource::RECORD_WITH_CONSTRUCTION_DISABLED: |
| 140 painting_control = | 144 painting_control = |
| 141 ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED; | 145 ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED; |
| 142 break; | 146 break; |
| 147 case DisplayListRecordingSource::RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED: |
| 148 painting_control = ContentLayerClient::SUBSEQUENCE_CACHING_DISABLED; |
| 149 break; |
| 143 default: | 150 default: |
| 144 NOTREACHED(); | 151 NOTREACHED(); |
| 145 } | 152 } |
| 146 base::TimeDelta min_time = base::TimeDelta::Max(); | 153 base::TimeDelta min_time = base::TimeDelta::Max(); |
| 147 size_t memory_used = 0; | 154 size_t memory_used = 0; |
| 148 | 155 |
| 149 scoped_refptr<DisplayItemList> display_list; | 156 scoped_refptr<DisplayItemList> display_list; |
| 150 for (int i = 0; i < record_repeat_count_; ++i) { | 157 for (int i = 0; i < record_repeat_count_; ++i) { |
| 151 // Run for a minimum amount of time to avoid problems with timer | 158 // Run for a minimum amount of time to avoid problems with timer |
| 152 // quantization when the layer is very small. | 159 // quantization when the layer is very small. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 194 } |
| 188 } | 195 } |
| 189 | 196 |
| 190 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 197 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
| 191 : pixels_recorded(0), bytes_used(0) { | 198 : pixels_recorded(0), bytes_used(0) { |
| 192 } | 199 } |
| 193 | 200 |
| 194 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 201 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
| 195 | 202 |
| 196 } // namespace cc | 203 } // namespace cc |
| OLD | NEW |