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

Unified Diff: tools/VisualBench/VisualBenchmarkStream.cpp

Issue 1395703002: small tidy of benchmarkstream (Closed) Base URL: https://skia.googlesource.com/skia.git@vb4b
Patch Set: remove debug print Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/VisualBench/VisualBenchmarkStream.h ('k') | tools/VisualBench/VisualStreamTimingModule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/VisualBench/VisualBenchmarkStream.cpp
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp
index c520eeed05510f6197152a4844f8d2cc1f72d81a..235200a761295a69e9e8f84478eba33a5941e25f 100644
--- a/tools/VisualBench/VisualBenchmarkStream.cpp
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp
@@ -74,6 +74,11 @@ VisualBenchmarkStream::VisualBenchmarkStream()
}
}
}
+
+ // seed with an initial benchmark
+ // NOTE the initial benchmark will not have preTimingHooks called, but that is okay because
+ // it is the warmupbench
+ this->next();
}
bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture>* pic) {
@@ -98,23 +103,24 @@ bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture
}
Benchmark* VisualBenchmarkStream::next() {
+ Benchmark* bench;
if (!fIsWarmedUp) {
fIsWarmedUp = true;
- return new WarmupBench;
- }
-
- Benchmark* bench;
-
- // skips non matching benches
- while ((bench = this->innerNext()) &&
- (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()) ||
- !bench->isSuitableFor(Benchmark::kGPU_Backend))) {
- bench->unref();
+ bench = new WarmupBench;
+ } else {
+ // skips non matching benches
+ while ((bench = this->innerNext()) &&
+ (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()) ||
+ !bench->isSuitableFor(Benchmark::kGPU_Backend))) {
+ bench->unref();
+ }
}
- if (FLAGS_cpu) {
- return new CpuWrappedBenchmark(bench);
+ if (bench && FLAGS_cpu) {
+ bench = new CpuWrappedBenchmark(bench);
}
- return bench;
+
+ fBenchmark.reset(bench);
+ return fBenchmark;
}
Benchmark* VisualBenchmarkStream::innerNext() {
« no previous file with comments | « tools/VisualBench/VisualBenchmarkStream.h ('k') | tools/VisualBench/VisualStreamTimingModule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698