OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 nullptr))->u
nref(); | 50 nullptr))->u
nref(); |
51 SkRect rect = SkRect::MakeLTRB(0., 0., 400., 400.); | 51 SkRect rect = SkRect::MakeLTRB(0., 0., 400., 400.); |
52 for (int i = 0; i < loops; i++) { | 52 for (int i = 0; i < loops; i++) { |
53 canvas->drawPath(fPath, paint); | 53 canvas->drawPath(fPath, paint); |
54 canvas->drawRect(rect, perlinPaint); | 54 canvas->drawRect(rect, perlinPaint); |
55 } | 55 } |
56 } | 56 } |
57 SkPath fPath; | 57 SkPath fPath; |
58 }; | 58 }; |
59 | 59 |
60 VisualBenchmarkStream::VisualBenchmarkStream() | 60 VisualBenchmarkStream::VisualBenchmarkStream(const SkSurfaceProps& surfaceProps) |
61 : fBenches(BenchRegistry::Head()) | 61 : fSurfaceProps(surfaceProps) |
| 62 , fBenches(BenchRegistry::Head()) |
62 , fGMs(skiagm::GMRegistry::Head()) | 63 , fGMs(skiagm::GMRegistry::Head()) |
63 , fSourceType(nullptr) | 64 , fSourceType(nullptr) |
64 , fBenchType(nullptr) | 65 , fBenchType(nullptr) |
65 , fCurrentSKP(0) | 66 , fCurrentSKP(0) |
66 , fIsWarmedUp(false) { | 67 , fIsWarmedUp(false) { |
67 for (int i = 0; i < FLAGS_skps.count(); i++) { | 68 for (int i = 0; i < FLAGS_skps.count(); i++) { |
68 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { | 69 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { |
69 fSKPs.push_back() = FLAGS_skps[i]; | 70 fSKPs.push_back() = FLAGS_skps[i]; |
70 } else { | 71 } else { |
71 SkOSFile::Iter it(FLAGS_skps[i], ".skp"); | 72 SkOSFile::Iter it(FLAGS_skps[i], ".skp"); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // skips non matching benches | 113 // skips non matching benches |
113 while ((bench = this->innerNext()) && | 114 while ((bench = this->innerNext()) && |
114 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName
()) || | 115 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName
()) || |
115 !bench->isSuitableFor(Benchmark::kGPU_Backend))) { | 116 !bench->isSuitableFor(Benchmark::kGPU_Backend))) { |
116 bench->unref(); | 117 bench->unref(); |
117 } | 118 } |
118 } | 119 } |
119 | 120 |
120 // TODO move this all to --config | 121 // TODO move this all to --config |
121 if (bench && FLAGS_cpu) { | 122 if (bench && FLAGS_cpu) { |
122 bench = new CpuWrappedBenchmark(bench); | 123 bench = new CpuWrappedBenchmark(fSurfaceProps, bench); |
123 } else if (bench && FLAGS_nvpr) { | 124 } else if (bench && FLAGS_nvpr) { |
124 bench = new NvprWrappedBenchmark(bench, 4); | 125 bench = new NvprWrappedBenchmark(fSurfaceProps, bench, 4); |
125 } | 126 } |
126 | 127 |
127 fBenchmark.reset(bench); | 128 fBenchmark.reset(bench); |
128 return fBenchmark; | 129 return fBenchmark; |
129 } | 130 } |
130 | 131 |
131 Benchmark* VisualBenchmarkStream::innerNext() { | 132 Benchmark* VisualBenchmarkStream::innerNext() { |
132 while (fBenches) { | 133 while (fBenches) { |
133 Benchmark* bench = fBenches->factory()(nullptr); | 134 Benchmark* bench = fBenches->factory()(nullptr); |
134 fBenches = fBenches->next(); | 135 fBenches = fBenches->next(); |
(...skipping 24 matching lines...) Expand all Loading... |
159 } | 160 } |
160 | 161 |
161 SkString name = SkOSPath::Basename(path.c_str()); | 162 SkString name = SkOSPath::Basename(path.c_str()); |
162 fSourceType = "skp"; | 163 fSourceType = "skp"; |
163 fBenchType = "playback"; | 164 fBenchType = "playback"; |
164 return new VisualSKPBench(name.c_str(), pic.get()); | 165 return new VisualSKPBench(name.c_str(), pic.get()); |
165 } | 166 } |
166 | 167 |
167 return nullptr; | 168 return nullptr; |
168 } | 169 } |
OLD | NEW |