| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 8 |
| 9 #include "VisualLightweightBenchModule.h" | 9 #include "VisualLightweightBenchModule.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 __SK_FORCE_IMAGE_DECODER_LINKING; | 24 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 25 | 25 |
| 26 // Between samples we reset context | 26 // Between samples we reset context |
| 27 // Between frames we swap buffers | 27 // Between frames we swap buffers |
| 28 | 28 |
| 29 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
s to lag."); | 29 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
s to lag."); |
| 30 DEFINE_int32(samples, 10, "Number of times to time each skp."); | 30 DEFINE_int32(samples, 10, "Number of times to time each skp."); |
| 31 DEFINE_int32(frames, 5, "Number of frames of each skp to render per sample."); | 31 DEFINE_int32(frames, 5, "Number of frames of each skp to render per sample."); |
| 32 DEFINE_double(loopMs, 5, "Target loop time in millseconds."); | 32 DEFINE_double(loopMs, 5, "Target loop time in millseconds."); |
| 33 DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver."); | 33 DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver."); |
| 34 DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-spec
ific names | |
| 35 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 34 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |
| 35 DEFINE_string(key, "", |
| 36 "Space-separated key/value pairs to add to JSON identifying this b
uilder."); |
| 36 DEFINE_string(properties, "", | 37 DEFINE_string(properties, "", |
| 37 "Space-separated key/value pairs to add to JSON identifying this r
un."); | 38 "Space-separated key/value pairs to add to JSON identifying this r
un."); |
| 38 | 39 |
| 39 static SkString humanize(double ms) { | 40 static SkString humanize(double ms) { |
| 40 if (FLAGS_verbose) { | 41 if (FLAGS_verbose) { |
| 41 return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); | 42 return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
| 42 } | 43 } |
| 43 return HumanizeMs(ms); | 44 return HumanizeMs(ms); |
| 44 } | 45 } |
| 45 | 46 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 56 fBenchmarkStream.reset(new VisualBenchmarkStream); | 57 fBenchmarkStream.reset(new VisualBenchmarkStream); |
| 57 | 58 |
| 58 // Print header | 59 // Print header |
| 59 SkDebugf("curr/maxrss\tloops\tflushes\tmin\tmedian\tmean\tmax\tstddev\tbench
\n"); | 60 SkDebugf("curr/maxrss\tloops\tflushes\tmin\tmedian\tmean\tmax\tstddev\tbench
\n"); |
| 60 | 61 |
| 61 // setup json logging if required | 62 // setup json logging if required |
| 62 if (!FLAGS_outResultsFile.isEmpty()) { | 63 if (!FLAGS_outResultsFile.isEmpty()) { |
| 63 fResults.reset(new NanoJSONResultsWriter(FLAGS_outResultsFile[0])); | 64 fResults.reset(new NanoJSONResultsWriter(FLAGS_outResultsFile[0])); |
| 64 } | 65 } |
| 65 | 66 |
| 67 if (1 == FLAGS_key.count() % 2) { |
| 68 SkDebugf("ERROR: --key must be passed with an even number of arguments.\
n"); |
| 69 } else { |
| 70 for (int i = 1; i < FLAGS_key.count(); i += 2) { |
| 71 fResults->key(FLAGS_key[i - 1], FLAGS_key[i]); |
| 72 } |
| 73 } |
| 74 |
| 66 if (1 == FLAGS_properties.count() % 2) { | 75 if (1 == FLAGS_properties.count() % 2) { |
| 67 SkDebugf("ERROR: --properties must be passed with an even number of argu
ments.\n"); | 76 SkDebugf("ERROR: --properties must be passed with an even number of argu
ments.\n"); |
| 68 } else { | 77 } else { |
| 69 for (int i = 1; i < FLAGS_properties.count(); i += 2) { | 78 for (int i = 1; i < FLAGS_properties.count(); i += 2) { |
| 70 fResults->property(FLAGS_properties[i - 1], FLAGS_properties[i]); | 79 fResults->property(FLAGS_properties[i - 1], FLAGS_properties[i]); |
| 71 } | 80 } |
| 72 } | 81 } |
| 73 } | 82 } |
| 74 | 83 |
| 75 inline void VisualLightweightBenchModule::renderFrame(SkCanvas* canvas) { | 84 inline void VisualLightweightBenchModule::renderFrame(SkCanvas* canvas) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 262 } |
| 254 this->resetTimingState(); | 263 this->resetTimingState(); |
| 255 } else { | 264 } else { |
| 256 fCurrentFrame++; | 265 fCurrentFrame++; |
| 257 } | 266 } |
| 258 } | 267 } |
| 259 | 268 |
| 260 bool VisualLightweightBenchModule::onHandleChar(SkUnichar c) { | 269 bool VisualLightweightBenchModule::onHandleChar(SkUnichar c) { |
| 261 return true; | 270 return true; |
| 262 } | 271 } |
| OLD | NEW |