diff options
Diffstat (limited to 'tools/VisualBench/VisualBenchmarkStream.cpp')
-rw-r--r-- | tools/VisualBench/VisualBenchmarkStream.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp index c520eeed05..235200a761 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() { |