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

Side by Side Diff: tools/VisualBench/VisualBenchmarkStream.cpp

Issue 1468233003: Add a warmup flag to visualbench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 5 years 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 2015 Google Inc. 2 * Copyright 2015 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 8
9 #include <VisualBench/VisualBenchmarkStream.h> 9 #include <VisualBench/VisualBenchmarkStream.h>
10 #include <VisualBench/WrappedBenchmark.h> 10 #include <VisualBench/WrappedBenchmark.h>
(...skipping 13 matching lines...) Expand all
24 DEFINE_string2(match, m, nullptr, 24 DEFINE_string2(match, m, nullptr,
25 "[~][^]substring[$] [...] of bench name to run.\n" 25 "[~][^]substring[$] [...] of bench name to run.\n"
26 "Multiple matches may be separated by spaces.\n" 26 "Multiple matches may be separated by spaces.\n"
27 "~ causes a matching bench to always be skipped\n" 27 "~ causes a matching bench to always be skipped\n"
28 "^ requires the start of the bench to match\n" 28 "^ requires the start of the bench to match\n"
29 "$ requires the end of the bench to match\n" 29 "$ requires the end of the bench to match\n"
30 "^ and $ requires an exact match\n" 30 "^ and $ requires an exact match\n"
31 "If a bench does not match any list entry,\n" 31 "If a bench does not match any list entry,\n"
32 "it is skipped unless some list entry starts with ~"); 32 "it is skipped unless some list entry starts with ~");
33 DEFINE_string(skps, "skps", "Directory to read skps from."); 33 DEFINE_string(skps, "skps", "Directory to read skps from.");
34 DEFINE_bool(warmup, true, "Include a warmup bench? (Excluding the warmup may com promise results)");
34 35
35 // We draw a big nonAA path to warmup the gpu / cpu 36 // We draw a big nonAA path to warmup the gpu / cpu
36 #include "SkPerlinNoiseShader.h" 37 #include "SkPerlinNoiseShader.h"
37 class WarmupBench : public Benchmark { 38 class WarmupBench : public Benchmark {
38 public: 39 public:
39 WarmupBench() { 40 WarmupBench() {
40 sk_tool_utils::make_big_path(fPath); 41 sk_tool_utils::make_big_path(fPath);
41 fPerlinRect = SkRect::MakeLTRB(0., 0., 400., 400.); 42 fPerlinRect = SkRect::MakeLTRB(0., 0., 400., 400.);
42 } 43 }
43 private: 44 private:
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 pic->reset(SkPicture::CreateFromStream(stream.get())); 120 pic->reset(SkPicture::CreateFromStream(stream.get()));
120 if (pic->get() == nullptr) { 121 if (pic->get() == nullptr) {
121 SkDebugf("Could not read %s as an SkPicture.\n", path); 122 SkDebugf("Could not read %s as an SkPicture.\n", path);
122 return false; 123 return false;
123 } 124 }
124 return true; 125 return true;
125 } 126 }
126 127
127 Benchmark* VisualBenchmarkStream::next() { 128 Benchmark* VisualBenchmarkStream::next() {
128 Benchmark* bench; 129 Benchmark* bench;
129 if (!fIsWarmedUp) { 130 if (FLAGS_warmup && !fIsWarmedUp) {
130 fIsWarmedUp = true; 131 fIsWarmedUp = true;
131 bench = new WarmupBench; 132 bench = new WarmupBench;
132 } else { 133 } else {
133 // skips non matching benches 134 // skips non matching benches
134 while ((bench = this->innerNext()) && 135 while ((bench = this->innerNext()) &&
135 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName ()) || 136 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName ()) ||
136 !bench->isSuitableFor(Benchmark::kGPU_Backend))) { 137 !bench->isSuitableFor(Benchmark::kGPU_Backend))) {
137 bench->unref(); 138 bench->unref();
138 } 139 }
139 } 140 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 181 }
181 182
182 SkString name = SkOSPath::Basename(path.c_str()); 183 SkString name = SkOSPath::Basename(path.c_str());
183 fSourceType = "skp"; 184 fSourceType = "skp";
184 fBenchType = "playback"; 185 fBenchType = "playback";
185 return new VisualSKPBench(name.c_str(), pic.get()); 186 return new VisualSKPBench(name.c_str(), pic.get());
186 } 187 }
187 188
188 return nullptr; 189 return nullptr;
189 } 190 }
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