| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 from chrome_remote_control import multi_page_benchmark | 4 from chrome_remote_control import multi_page_benchmark |
| 5 from gpu_tools import scrolling_benchmark | 5 from gpu_tools import scrolling_benchmark |
| 6 | 6 |
| 7 class TextureUploadBenchmark(scrolling_benchmark.ScrollingBenchmark): | 7 class TextureUploadBenchmark(scrolling_benchmark.ScrollingBenchmark): |
| 8 def MeasurePage(self, _, tab): | 8 def MeasurePage(self, _, tab): |
| 9 rendering_stats_deltas = self.ScrollPageFully(tab) | 9 rendering_stats_deltas = self.ScrollPageFully(tab) |
| 10 |
| 11 if (("totalCommitCount" not in rendering_stats_deltas) |
| 12 or rendering_stats_deltas["totalCommitCount"] == 0) : |
| 13 averageCommitTimeMs = 0 |
| 14 else : |
| 15 averageCommitTimeMs = ( |
| 16 1000 * rendering_stats_deltas["totalCommitTimeInSeconds"] / |
| 17 rendering_stats_deltas["totalCommitCount"]) |
| 18 |
| 10 return { | 19 return { |
| 11 'texture_upload_count': rendering_stats_deltas['textureUploadCount'] | 20 'texture_upload_count': rendering_stats_deltas['textureUploadCount'], |
| 21 'average_commit_time_ms': averageCommitTimeMs |
| 12 } | 22 } |
| 13 | 23 |
| 14 def Main(): | 24 def Main(): |
| 15 return multi_page_benchmark.Main(TextureUploadBenchmark()) | 25 return multi_page_benchmark.Main(TextureUploadBenchmark()) |
| OLD | NEW |