| 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 <algorithm> |    7 #include <algorithm> | 
|    8 #include <limits> |    8 #include <limits> | 
|    9 #include <string> |    9 #include <string> | 
|   10  |   10  | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  123     const int kTimeCheckInterval = 1; |  123     const int kTimeCheckInterval = 1; | 
|  124  |  124  | 
|  125     for (int i = 0; i < record_repeat_count_; ++i) { |  125     for (int i = 0; i < record_repeat_count_; ++i) { | 
|  126       // Run for a minimum amount of time to avoid problems with timer |  126       // Run for a minimum amount of time to avoid problems with timer | 
|  127       // quantization when the layer is very small. |  127       // quantization when the layer is very small. | 
|  128       LapTimer timer(kWarmupRuns, |  128       LapTimer timer(kWarmupRuns, | 
|  129                      base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |  129                      base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 
|  130                      kTimeCheckInterval); |  130                      kTimeCheckInterval); | 
|  131       do { |  131       do { | 
|  132         scoped_refptr<Picture> picture = Picture::Create( |  132         scoped_refptr<Picture> picture = Picture::Create( | 
|  133             visible_content_rect, painter, tile_grid_info, false, 0, mode); |  133             visible_content_rect, painter, tile_grid_info, false, mode); | 
|  134         timer.NextLap(); |  134         timer.NextLap(); | 
|  135       } while (!timer.HasTimeLimitExpired()); |  135       } while (!timer.HasTimeLimitExpired()); | 
|  136       base::TimeDelta duration = |  136       base::TimeDelta duration = | 
|  137           base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); |  137           base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); | 
|  138       if (duration < min_time) |  138       if (duration < min_time) | 
|  139         min_time = duration; |  139         min_time = duration; | 
|  140     } |  140     } | 
|  141  |  141  | 
|  142     if (mode == Picture::RECORD_NORMALLY) { |  142     if (mode == Picture::RECORD_NORMALLY) { | 
|  143       record_results_.pixels_recorded += |  143       record_results_.pixels_recorded += | 
|  144           visible_content_rect.width() * visible_content_rect.height(); |  144           visible_content_rect.width() * visible_content_rect.height(); | 
|  145     } |  145     } | 
|  146     record_results_.total_best_time[mode_index] += min_time; |  146     record_results_.total_best_time[mode_index] += min_time; | 
|  147   } |  147   } | 
|  148 } |  148 } | 
|  149  |  149  | 
|  150 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |  150 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 
|  151     : pixels_recorded(0) {} |  151     : pixels_recorded(0) {} | 
|  152  |  152  | 
|  153 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |  153 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 
|  154  |  154  | 
|  155 }  // namespace cc |  155 }  // namespace cc | 
| OLD | NEW |