| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 SkCommandLineFlags::Parse(argc, argv); | 231 SkCommandLineFlags::Parse(argc, argv); |
| 232 | 232 |
| 233 const double overhead = estimate_timer_overhead(); | 233 const double overhead = estimate_timer_overhead(); |
| 234 SkAutoTMalloc<double> samples(FLAGS_samples); | 234 SkAutoTMalloc<double> samples(FLAGS_samples); |
| 235 | 235 |
| 236 if (FLAGS_verbose) { | 236 if (FLAGS_verbose) { |
| 237 // No header. | 237 // No header. |
| 238 } else if (FLAGS_quiet) { | 238 } else if (FLAGS_quiet) { |
| 239 SkDebugf("median\tbench\tconfig\n"); | 239 SkDebugf("median\tbench\tconfig\n"); |
| 240 } else { | 240 } else { |
| 241 SkDebugf("loops\tmin\tmedian\tmean\tmax\tstddev\tconfig\tbench\n"); | 241 SkDebugf("loops\tmin\tmedian\tmean\tmax\tstddev\tsamples\tconfig\tbench\
n"); |
| 242 } | 242 } |
| 243 | 243 |
| 244 for (const BenchRegistry* r = BenchRegistry::Head(); r != NULL; r = r->next(
)) { | 244 for (const BenchRegistry* r = BenchRegistry::Head(); r != NULL; r = r->next(
)) { |
| 245 SkAutoTDelete<Benchmark> bench(r->factory()(NULL)); | 245 SkAutoTDelete<Benchmark> bench(r->factory()(NULL)); |
| 246 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { | 246 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { |
| 247 continue; | 247 continue; |
| 248 } | 248 } |
| 249 | 249 |
| 250 SkTDArray<Target*> targets; | 250 SkTDArray<Target*> targets; |
| 251 create_targets(bench.get(), &targets); | 251 create_targets(bench.get(), &targets); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 270 SkDebugf("%s ", humanize(samples[i]).c_str()); | 270 SkDebugf("%s ", humanize(samples[i]).c_str()); |
| 271 } | 271 } |
| 272 SkDebugf("%s\n", bench->getName()); | 272 SkDebugf("%s\n", bench->getName()); |
| 273 } else if (FLAGS_quiet) { | 273 } else if (FLAGS_quiet) { |
| 274 if (targets.count() == 1) { | 274 if (targets.count() == 1) { |
| 275 config = ""; // Only print the config if we run the same ben
ch on more than one. | 275 config = ""; // Only print the config if we run the same ben
ch on more than one. |
| 276 } | 276 } |
| 277 SkDebugf("%s\t%s\t%s\n", humanize(stats.median).c_str(), bench->
getName(), config); | 277 SkDebugf("%s\t%s\t%s\n", humanize(stats.median).c_str(), bench->
getName(), config); |
| 278 } else { | 278 } else { |
| 279 const double stddev_percent = 100 * sqrt(stats.var) / stats.mean
; | 279 const double stddev_percent = 100 * sqrt(stats.var) / stats.mean
; |
| 280 SkDebugf("%d\t%s\t%s\t%s\t%s\t%.0f%%\t%s\t%s\n" | 280 SkDebugf("%d\t%s\t%s\t%s\t%s\t%.0f%%\t%s\t%s\t%s\n" |
| 281 , loops | 281 , loops |
| 282 , humanize(stats.min).c_str() | 282 , humanize(stats.min).c_str() |
| 283 , humanize(stats.median).c_str() | 283 , humanize(stats.median).c_str() |
| 284 , humanize(stats.mean).c_str() | 284 , humanize(stats.mean).c_str() |
| 285 , humanize(stats.max).c_str() | 285 , humanize(stats.max).c_str() |
| 286 , stddev_percent | 286 , stddev_percent |
| 287 , stats.plot.c_str() |
| 287 , config | 288 , config |
| 288 , bench->getName() | 289 , bench->getName() |
| 289 ); | 290 ); |
| 290 } | 291 } |
| 291 } | 292 } |
| 292 targets.deleteAll(); | 293 targets.deleteAll(); |
| 293 } | 294 } |
| 294 | 295 |
| 295 return 0; | 296 return 0; |
| 296 } | 297 } |
| 297 | 298 |
| 298 #if !defined SK_BUILD_FOR_IOS | 299 #if !defined SK_BUILD_FOR_IOS |
| 299 int main(int argc, char * const argv[]) { | 300 int main(int argc, char * const argv[]) { |
| 300 return tool_main(argc, (char**) argv); | 301 return tool_main(argc, (char**) argv); |
| 301 } | 302 } |
| 302 #endif | 303 #endif |
| OLD | NEW |