| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright 2014 Google Inc. |    2  * Copyright 2014 Google Inc. | 
|    3  * |    3  * | 
|    4  * Use of this source code is governed by a BSD-style license that can be |    4  * Use of this source code is governed by a BSD-style license that can be | 
|    5  * found in the LICENSE file. |    5  * found in the LICENSE file. | 
|    6  */ |    6  */ | 
|    7  |    7  | 
|    8 #include <ctype.h> |    8 #include <ctype.h> | 
|    9  |    9  | 
|   10 #include "Benchmark.h" |   10 #include "Benchmark.h" | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   49 } |   49 } | 
|   50  |   50  | 
|   51 DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str()); |   51 DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str()); | 
|   52  |   52  | 
|   53 DEFINE_int32(samples, 10, "Number of samples to measure for each bench."); |   53 DEFINE_int32(samples, 10, "Number of samples to measure for each bench."); | 
|   54 DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead."); |   54 DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead."); | 
|   55 DEFINE_double(overheadGoal, 0.0001, |   55 DEFINE_double(overheadGoal, 0.0001, | 
|   56               "Loop until timer overhead is at most this fraction of our measurm
     ents."); |   56               "Loop until timer overhead is at most this fraction of our measurm
     ents."); | 
|   57 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); |   57 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); | 
|   58 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
     s to lag."); |   58 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
     s to lag."); | 
 |   59 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling
      back to " | 
 |   60                                           "software path rendering."); | 
|   59  |   61  | 
|   60 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |   62 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 
|   61 DEFINE_int32(maxCalibrationAttempts, 3, |   63 DEFINE_int32(maxCalibrationAttempts, 3, | 
|   62              "Try up to this many times to guess loops for a bench, or skip the 
     bench."); |   64              "Try up to this many times to guess loops for a bench, or skip the 
     bench."); | 
|   63 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); |   65 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); | 
|   64 DEFINE_string(key, "", "Space-separated key/value pairs to add to JSON."); |   66 DEFINE_string(key, "", "Space-separated key/value pairs to add to JSON."); | 
|   65 DEFINE_string(gitHash, "", "Git hash to add to JSON."); |   67 DEFINE_string(gitHash, "", "Git hash to add to JSON."); | 
|   66  |   68  | 
|   67 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); |   69 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); | 
|   68 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); |   70 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); | 
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  522     int fCurrentScale; |  524     int fCurrentScale; | 
|  523     int fCurrentSKP; |  525     int fCurrentSKP; | 
|  524 }; |  526 }; | 
|  525  |  527  | 
|  526 int nanobench_main(); |  528 int nanobench_main(); | 
|  527 int nanobench_main() { |  529 int nanobench_main() { | 
|  528     SetupCrashHandler(); |  530     SetupCrashHandler(); | 
|  529     SkAutoGraphics ag; |  531     SkAutoGraphics ag; | 
|  530  |  532  | 
|  531 #if SK_SUPPORT_GPU |  533 #if SK_SUPPORT_GPU | 
|  532     gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (GrContext::Options()))); |  534     GrContext::Options grContextOpts; | 
 |  535     grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; | 
 |  536     gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (grContextOpts))); | 
|  533 #endif |  537 #endif | 
|  534  |  538  | 
|  535     if (kAutoTuneLoops != FLAGS_loops) { |  539     if (kAutoTuneLoops != FLAGS_loops) { | 
|  536         FLAGS_samples     = 1; |  540         FLAGS_samples     = 1; | 
|  537         FLAGS_gpuFrameLag = 0; |  541         FLAGS_gpuFrameLag = 0; | 
|  538     } |  542     } | 
|  539  |  543  | 
|  540     if (!FLAGS_writePath.isEmpty()) { |  544     if (!FLAGS_writePath.isEmpty()) { | 
|  541         SkDebugf("Writing files to %s.\n", FLAGS_writePath[0]); |  545         SkDebugf("Writing files to %s.\n", FLAGS_writePath[0]); | 
|  542         if (!sk_mkdir(FLAGS_writePath[0])) { |  546         if (!sk_mkdir(FLAGS_writePath[0])) { | 
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  685  |  689  | 
|  686     return 0; |  690     return 0; | 
|  687 } |  691 } | 
|  688  |  692  | 
|  689 #if !defined SK_BUILD_FOR_IOS |  693 #if !defined SK_BUILD_FOR_IOS | 
|  690 int main(int argc, char** argv) { |  694 int main(int argc, char** argv) { | 
|  691     SkCommandLineFlags::Parse(argc, argv); |  695     SkCommandLineFlags::Parse(argc, argv); | 
|  692     return nanobench_main(); |  696     return nanobench_main(); | 
|  693 } |  697 } | 
|  694 #endif |  698 #endif | 
| OLD | NEW |