| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This small program is used to measure the performance of the various | 5 // This small program is used to measure the performance of the various |
| 6 // resize algorithms offered by the ImageOperations::Resize function. | 6 // resize algorithms offered by the ImageOperations::Resize function. |
| 7 // It will generate an empty source bitmap, and rescale it to specified | 7 // It will generate an empty source bitmap, and rescale it to specified |
| 8 // dimensions. It will repeat this operation multiple time to get more accurate | 8 // dimensions. It will repeat this operation multiple time to get more accurate |
| 9 // average throughput. Because it uses elapsed time to do its math, it is only | 9 // average throughput. Because it uses elapsed time to do its math, it is only |
| 10 // accurate on an idle system (but that approach was deemed more accurate | 10 // accurate on an idle system (but that approach was deemed more accurate |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 dest = skia::ImageOperations::Resize(source, | 242 dest = skia::ImageOperations::Resize(source, |
| 243 method_, | 243 method_, |
| 244 dest_.width(), dest_.height()); | 244 dest_.width(), dest_.height()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 const int64 elapsed_us = (base::TimeTicks::Now() - start).InMicroseconds(); | 247 const int64 elapsed_us = (base::TimeTicks::Now() - start).InMicroseconds(); |
| 248 | 248 |
| 249 const uint64 num_bytes = static_cast<uint64>(num_iterations_) * | 249 const uint64 num_bytes = static_cast<uint64>(num_iterations_) * |
| 250 (GetBitmapSize(&source) + GetBitmapSize(&dest)); | 250 (GetBitmapSize(&source) + GetBitmapSize(&dest)); |
| 251 | 251 |
| 252 printf("%"PRIu64" MB/s,\telapsed = %"PRIu64" source=%d dest=%d\n", | 252 printf("%" PRIu64 " MB/s,\telapsed = %" PRIu64 " source=%d dest=%d\n", |
| 253 static_cast<uint64>(elapsed_us == 0 ? 0 : num_bytes / elapsed_us), | 253 static_cast<uint64>(elapsed_us == 0 ? 0 : num_bytes / elapsed_us), |
| 254 static_cast<uint64>(elapsed_us), | 254 static_cast<uint64>(elapsed_us), |
| 255 GetBitmapSize(&source), GetBitmapSize(&dest)); | 255 GetBitmapSize(&source), GetBitmapSize(&dest)); |
| 256 | 256 |
| 257 return true; | 257 return true; |
| 258 } | 258 } |
| 259 | 259 |
| 260 // A small class to automatically call Reset on the global command line to | 260 // A small class to automatically call Reset on the global command line to |
| 261 // avoid nasty valgrind complaints for the leak of the global command line. | 261 // avoid nasty valgrind complaints for the leak of the global command line. |
| 262 class CommandLineAutoReset { | 262 class CommandLineAutoReset { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 284 return 1; | 284 return 1; |
| 285 } | 285 } |
| 286 | 286 |
| 287 if (!bench.Run()) { | 287 if (!bench.Run()) { |
| 288 printf("Failed to run benchmark\n"); | 288 printf("Failed to run benchmark\n"); |
| 289 return 1; | 289 return 1; |
| 290 } | 290 } |
| 291 | 291 |
| 292 return 0; | 292 return 0; |
| 293 } | 293 } |
| OLD | NEW |