Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: bench/nanobench.cpp

Issue 653083003: nanobench: flush after recording every Nth data point. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: --flushEvery Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bench/ResultsWriter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling back to " 63 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling back to "
64 "software path rendering."); 64 "software path rendering.");
65 65
66 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); 66 DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
67 DEFINE_int32(maxCalibrationAttempts, 3, 67 DEFINE_int32(maxCalibrationAttempts, 3,
68 "Try up to this many times to guess loops for a bench, or skip the bench."); 68 "Try up to this many times to guess loops for a bench, or skip the bench.");
69 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); 69 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this.");
70 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); 70 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
71 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); 71 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
72 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); 72 DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
73 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
73 74
74 static SkString humanize(double ms) { 75 static SkString humanize(double ms) {
75 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); 76 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6));
76 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); 77 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3);
77 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); 78 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6);
78 #ifdef SK_BUILD_FOR_WIN 79 #ifdef SK_BUILD_FOR_WIN
79 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); 80 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3);
80 #else 81 #else
81 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3); 82 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3);
82 #endif 83 #endif
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } else if (FLAGS_quiet) { 622 } else if (FLAGS_quiet) {
622 SkDebugf("median\tbench\tconfig\n"); 623 SkDebugf("median\tbench\tconfig\n");
623 } else { 624 } else {
624 SkDebugf("maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\t%-*s\tconfig\tb ench\n", 625 SkDebugf("maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\t%-*s\tconfig\tb ench\n",
625 FLAGS_samples, "samples"); 626 FLAGS_samples, "samples");
626 } 627 }
627 628
628 SkTDArray<Config> configs; 629 SkTDArray<Config> configs;
629 create_configs(&configs); 630 create_configs(&configs);
630 631
632 int runs = 0;
631 BenchmarkStream benchStream; 633 BenchmarkStream benchStream;
632 while (Benchmark* b = benchStream.next()) { 634 while (Benchmark* b = benchStream.next()) {
633 SkAutoTDelete<Benchmark> bench(b); 635 SkAutoTDelete<Benchmark> bench(b);
634 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName())) { 636 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName())) {
635 continue; 637 continue;
636 } 638 }
637 639
638 SkTDArray<Target*> targets; 640 SkTDArray<Target*> targets;
639 create_targets(&targets, bench.get(), configs); 641 create_targets(&targets, bench.get(), configs);
640 642
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 #if SK_SUPPORT_GPU 675 #if SK_SUPPORT_GPU
674 if (Benchmark::kGPU_Backend == targets[j]->config.backend) { 676 if (Benchmark::kGPU_Backend == targets[j]->config.backend) {
675 fill_gpu_options(log.get(), targets[j]->gl); 677 fill_gpu_options(log.get(), targets[j]->gl);
676 } 678 }
677 #endif 679 #endif
678 log->timer("min_ms", stats.min); 680 log->timer("min_ms", stats.min);
679 log->timer("median_ms", stats.median); 681 log->timer("median_ms", stats.median);
680 log->timer("mean_ms", stats.mean); 682 log->timer("mean_ms", stats.mean);
681 log->timer("max_ms", stats.max); 683 log->timer("max_ms", stats.max);
682 log->timer("stddev_ms", sqrt(stats.var)); 684 log->timer("stddev_ms", sqrt(stats.var));
685 if (runs++ % FLAGS_flushEvery == 0) {
686 log->flush();
687 }
683 688
684 if (kAutoTuneLoops != FLAGS_loops) { 689 if (kAutoTuneLoops != FLAGS_loops) {
685 if (targets.count() == 1) { 690 if (targets.count() == 1) {
686 config = ""; // Only print the config if we run the same ben ch on more than one. 691 config = ""; // Only print the config if we run the same ben ch on more than one.
687 } 692 }
688 SkDebugf("%4dM\t%s\t%s\n" 693 SkDebugf("%4dM\t%s\t%s\n"
689 , sk_tools::getMaxResidentSetSizeMB() 694 , sk_tools::getMaxResidentSetSizeMB()
690 , bench->getUniqueName() 695 , bench->getUniqueName()
691 , config); 696 , config);
692 } else if (FLAGS_verbose) { 697 } else if (FLAGS_verbose) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 734
730 return 0; 735 return 0;
731 } 736 }
732 737
733 #if !defined SK_BUILD_FOR_IOS 738 #if !defined SK_BUILD_FOR_IOS
734 int main(int argc, char** argv) { 739 int main(int argc, char** argv) {
735 SkCommandLineFlags::Parse(argc, argv); 740 SkCommandLineFlags::Parse(argc, argv);
736 return nanobench_main(); 741 return nanobench_main();
737 } 742 }
738 #endif 743 #endif
OLDNEW
« no previous file with comments | « bench/ResultsWriter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698