Index: tools/VisualBench/VisualBenchmarkStream.cpp |
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp |
index 9e1ce36fbc12ec189a101ba832b3ee0288c7c76f..adf82085caf353d7b0da673204e60804cbf4c9b3 100644 |
--- a/tools/VisualBench/VisualBenchmarkStream.cpp |
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp |
@@ -10,6 +10,7 @@ |
#include "CpuWrappedBenchmark.h" |
#include "GMBench.h" |
#include "SkOSFile.h" |
+#include "SkPath.h" |
#include "SkPictureRecorder.h" |
#include "SkStream.h" |
#include "VisualSKPBench.h" |
@@ -26,12 +27,35 @@ DEFINE_string2(match, m, nullptr, |
"it is skipped unless some list entry starts with ~"); |
DEFINE_string(skps, "skps", "Directory to read skps from."); |
+// We draw a big nonAA path to warmup the gpu / cpu |
+class WarmupBench : public Benchmark { |
+public: |
+ WarmupBench() { |
+ make_path(fPath); |
+ } |
+private: |
robertphillips
2015/10/05 13:05:01
MakePath ?
|
+ static void make_path(SkPath& path) { |
robertphillips
2015/10/05 13:05:01
Maybe have a MakeBigPath helper in sk_tools_utils
|
+ #include "BigPathBench.inc" |
+ } |
+ const char* onGetName() override { return "warmupbench"; } |
+ void onDraw(int loops, SkCanvas* canvas) override { |
+ SkPaint paint; |
+ paint.setStyle(SkPaint::kStroke_Style); |
+ paint.setStrokeWidth(2); |
+ for (int i = 0; i < loops; i++) { |
+ canvas->drawPath(fPath, paint); |
+ } |
+ } |
+ SkPath fPath; |
+}; |
+ |
VisualBenchmarkStream::VisualBenchmarkStream() |
: fBenches(BenchRegistry::Head()) |
, fGMs(skiagm::GMRegistry::Head()) |
, fSourceType(nullptr) |
, fBenchType(nullptr) |
- , fCurrentSKP(0) { |
+ , fCurrentSKP(0) |
+ , fIsWarmedUp(false) { |
for (int i = 0; i < FLAGS_skps.count(); i++) { |
if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { |
fSKPs.push_back() = FLAGS_skps[i]; |
@@ -67,7 +91,13 @@ bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture |
} |
Benchmark* VisualBenchmarkStream::next() { |
+ if (!fIsWarmedUp) { |
+ fIsWarmedUp = true; |
+ return new WarmupBench; |
+ } |
+ |
Benchmark* bench; |
+ |
// skips non matching benches |
while ((bench = this->innerNext()) && |
(SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()) || |