Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 kNormal_BenchMode, | 36 kNormal_BenchMode, |
| 37 kDeferred_BenchMode, | 37 kDeferred_BenchMode, |
| 38 kDeferredSilent_BenchMode, | 38 kDeferredSilent_BenchMode, |
| 39 kRecord_BenchMode, | 39 kRecord_BenchMode, |
| 40 kPictureRecord_BenchMode | 40 kPictureRecord_BenchMode |
| 41 }; | 41 }; |
| 42 const char* BenchMode_Name[] = { | 42 const char* BenchMode_Name[] = { |
| 43 "normal", "deferred", "deferredSilent", "record", "picturerecord" | 43 "normal", "deferred", "deferredSilent", "record", "picturerecord" |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 static const char kDefaultsConfigStr[] = "defaults"; | |
| 47 | |
| 46 /////////////////////////////////////////////////////////////////////////////// | 48 /////////////////////////////////////////////////////////////////////////////// |
| 47 | 49 |
| 48 static void erase(SkBitmap& bm) { | 50 static void erase(SkBitmap& bm) { |
| 49 if (bm.config() == SkBitmap::kA8_Config) { | 51 if (bm.config() == SkBitmap::kA8_Config) { |
| 50 bm.eraseColor(SK_ColorTRANSPARENT); | 52 bm.eraseColor(SK_ColorTRANSPARENT); |
| 51 } else { | 53 } else { |
| 52 bm.eraseColor(SK_ColorWHITE); | 54 bm.eraseColor(SK_ColorWHITE); |
| 53 } | 55 } |
| 54 } | 56 } |
| 55 | 57 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 "$ requires the end of the test to match\n" | 268 "$ requires the end of the test to match\n" |
| 267 "^ and $ requires an exact match\n" | 269 "^ and $ requires an exact match\n" |
| 268 "If a test does not match any list entry,\n" | 270 "If a test does not match any list entry,\n" |
| 269 "it is skipped unless some list entry starts with ~\n" ); | 271 "it is skipped unless some list entry starts with ~\n" ); |
| 270 DEFINE_string(mode, "normal", | 272 DEFINE_string(mode, "normal", |
| 271 "normal: draw to a normal canvas;\n" | 273 "normal: draw to a normal canvas;\n" |
| 272 "deferred: draw to a deferred canvas;\n" | 274 "deferred: draw to a deferred canvas;\n" |
| 273 "deferredSilent: deferred with silent playback;\n" | 275 "deferredSilent: deferred with silent playback;\n" |
| 274 "record: draw to an SkPicture;\n" | 276 "record: draw to an SkPicture;\n" |
| 275 "picturerecord: draw from an SkPicture to an SkPicture.\n"); | 277 "picturerecord: draw from an SkPicture to an SkPicture.\n"); |
| 276 DEFINE_string(config, "", "Run configs given. If empty, runs the defaults set i n gConfigs."); | 278 DEFINE_string(config, "", "Run configs given. If empty, runs the defaults set i n gConfigs."); |
|
scroggo
2013/09/16 18:01:47
Maybe update the help line?
mtklein
2013/09/16 18:02:59
Why don't we default this to "defaults", and cut o
borenet
2013/09/16 18:23:51
Done.
| |
| 277 DEFINE_string(logFile, "", "Also write stdout here."); | 279 DEFINE_string(logFile, "", "Also write stdout here."); |
| 278 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run."); | 280 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run."); |
| 279 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run."); | 281 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run."); |
| 280 DEFINE_double(error, 0.01, | 282 DEFINE_double(error, 0.01, |
| 281 "Ratio of subsequent bench measurements must drop within 1±error t o converge."); | 283 "Ratio of subsequent bench measurements must drop within 1±error t o converge."); |
| 282 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops."); | 284 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops."); |
| 283 DEFINE_bool2(verbose, v, false, "Print more."); | 285 DEFINE_bool2(verbose, v, false, "Print more."); |
| 284 | 286 |
| 285 // Has this bench converged? First arguments are milliseconds / loop iteration, | 287 // Has this bench converged? First arguments are milliseconds / loop iteration, |
| 286 // last is overall runtime in milliseconds. | 288 // last is overall runtime in milliseconds. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 317 } | 319 } |
| 318 | 320 |
| 319 BenchMode benchMode = kNormal_BenchMode; | 321 BenchMode benchMode = kNormal_BenchMode; |
| 320 for (size_t i = 0; i < SK_ARRAY_COUNT(BenchMode_Name); i++) { | 322 for (size_t i = 0; i < SK_ARRAY_COUNT(BenchMode_Name); i++) { |
| 321 if (strcmp(FLAGS_mode[0], BenchMode_Name[i]) == 0) { | 323 if (strcmp(FLAGS_mode[0], BenchMode_Name[i]) == 0) { |
| 322 benchMode = static_cast<BenchMode>(i); | 324 benchMode = static_cast<BenchMode>(i); |
| 323 } | 325 } |
| 324 } | 326 } |
| 325 | 327 |
| 326 SkTDArray<int> configs; | 328 SkTDArray<int> configs; |
| 329 bool runDefaultConfigs = false; | |
| 327 // Try user-given configs first. | 330 // Try user-given configs first. |
| 328 for (int i = 0; i < FLAGS_config.count(); i++) { | 331 for (int i = 0; i < FLAGS_config.count(); i++) { |
| 329 for (size_t j = 0; j < SK_ARRAY_COUNT(gConfigs); j++) { | 332 for (size_t j = 0; j < SK_ARRAY_COUNT(gConfigs); j++) { |
| 330 if (0 == strcmp(FLAGS_config[i], gConfigs[j].name)) { | 333 if (0 == strcmp(FLAGS_config[i], gConfigs[j].name)) { |
| 331 *configs.append() = j; | 334 *configs.append() = j; |
| 335 } else if (0 == strcmp(FLAGS_config[i], kDefaultsConfigStr)) { | |
|
mtklein
2013/09/16 18:02:59
This may seem like heresy, but I think "defaults"
borenet
2013/09/16 18:23:51
I kept it the same, since I added a reference in t
| |
| 336 runDefaultConfigs = true; | |
| 332 } | 337 } |
| 333 } | 338 } |
| 334 } | 339 } |
| 335 // If there weren't any, fill in with defaults. | 340 // If there weren't any, fill in with defaults. |
| 336 if (configs.count() == 0) { | 341 if (configs.count() == 0 || runDefaultConfigs) { |
|
mtklein
2013/09/16 18:02:59
If you change the default value of --config, I'd c
borenet
2013/09/16 18:23:51
Removing that condition causes no configs to be ru
| |
| 337 for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) { | 342 for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) { |
| 338 if (gConfigs[i].runByDefault) { | 343 if (gConfigs[i].runByDefault) { |
| 339 *configs.append() = i; | 344 *configs.append() = i; |
| 340 } | 345 } |
| 341 } | 346 } |
| 342 } | 347 } |
| 343 // Filter out things we can't run. | 348 // Filter out things we can't run. |
| 344 if (kNormal_BenchMode != benchMode) { | 349 if (kNormal_BenchMode != benchMode) { |
| 345 // Non-rendering configs only run in normal mode | 350 // Non-rendering configs only run in normal mode |
| 346 for (int i = 0; i < configs.count(); ++i) { | 351 for (int i = 0; i < configs.count(); ++i) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 gContextFactory.destroyContexts(); | 657 gContextFactory.destroyContexts(); |
| 653 #endif | 658 #endif |
| 654 return 0; | 659 return 0; |
| 655 } | 660 } |
| 656 | 661 |
| 657 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 662 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 658 int main(int argc, char * const argv[]) { | 663 int main(int argc, char * const argv[]) { |
| 659 return tool_main(argc, (char**) argv); | 664 return tool_main(argc, (char**) argv); |
| 660 } | 665 } |
| 661 #endif | 666 #endif |
| OLD | NEW |