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

Side by Side Diff: bench/nanobench.cpp

Issue 1666743002: Add --benchType and --sourceType to nanobench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | 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 "nanobench.h" 10 #include "nanobench.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 "function that ping-pongs between 1.0 and zoomMax." ); 105 "function that ping-pongs between 1.0 and zoomMax." );
106 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); 106 DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
107 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?"); 107 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
108 DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?"); 108 DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?");
109 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); 109 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
110 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test ."); 110 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test .");
111 DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?"); 111 DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
112 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json") ; 112 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json") ;
113 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t ime out"); 113 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t ime out");
114 114
115 DEFINE_string(sourceType, "",
116 "Apply usual --match rules to source type: bench, gm, skp, image, etc.") ;
117 DEFINE_string(benchType, "",
118 "Apply usual --match rules to bench type: micro, recording, playback, sk codec, etc.");
119
115 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } 120 static double now_ms() { return SkTime::GetNSecs() * 1e-6; }
116 121
117 static SkString humanize(double ms) { 122 static SkString humanize(double ms) {
118 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); 123 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6));
119 return HumanizeMs(ms); 124 return HumanizeMs(ms);
120 } 125 }
121 #define HUMANIZE(ms) humanize(ms).c_str() 126 #define HUMANIZE(ms) humanize(ms).c_str()
122 127
123 bool Target::init(SkImageInfo info, Benchmark* bench) { 128 bool Target::init(SkImageInfo info, Benchmark* bench) {
124 if (Benchmark::kRaster_Backend == config.backend) { 129 if (Benchmark::kRaster_Backend == config.backend) {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 626
622 pic->reset(SkPicture::CreateFromStream(stream.get())); 627 pic->reset(SkPicture::CreateFromStream(stream.get()));
623 if (pic->get() == nullptr) { 628 if (pic->get() == nullptr) {
624 SkDebugf("Could not read %s as an SkPicture.\n", path); 629 SkDebugf("Could not read %s as an SkPicture.\n", path);
625 return false; 630 return false;
626 } 631 }
627 return true; 632 return true;
628 } 633 }
629 634
630 Benchmark* next() { 635 Benchmark* next() {
636 SkAutoTDelete<Benchmark> bench;
637 do {
638 bench.reset(this->rawNext());
639 if (!bench) {
640 return nullptr;
641 }
642 } while(SkCommandLineFlags::ShouldSkip(FLAGS_sourceType, fSourceType) ||
643 SkCommandLineFlags::ShouldSkip(FLAGS_benchType, fBenchType));
644 return bench.detach();
645 }
646
647 Benchmark* rawNext() {
631 if (fBenches) { 648 if (fBenches) {
632 Benchmark* bench = fBenches->factory()(nullptr); 649 Benchmark* bench = fBenches->factory()(nullptr);
633 fBenches = fBenches->next(); 650 fBenches = fBenches->next();
634 fSourceType = "bench"; 651 fSourceType = "bench";
635 fBenchType = "micro"; 652 fBenchType = "micro";
636 return bench; 653 return bench;
637 } 654 }
638 655
639 while (fGMs) { 656 while (fGMs) {
640 SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(nullptr)); 657 SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(nullptr));
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 1233
1217 return 0; 1234 return 0;
1218 } 1235 }
1219 1236
1220 #if !defined SK_BUILD_FOR_IOS 1237 #if !defined SK_BUILD_FOR_IOS
1221 int main(int argc, char** argv) { 1238 int main(int argc, char** argv) {
1222 SkCommandLineFlags::Parse(argc, argv); 1239 SkCommandLineFlags::Parse(argc, argv);
1223 return nanobench_main(); 1240 return nanobench_main();
1224 } 1241 }
1225 #endif 1242 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698