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 "CpuWrappedBenchmark.h" | 10 #include <VisualBench/WrappedBenchmark.h> |
11 #include "GMBench.h" | 11 #include "GMBench.h" |
12 #include "SkOSFile.h" | 12 #include "SkOSFile.h" |
13 #include "SkPath.h" | 13 #include "SkPath.h" |
14 #include "SkPictureRecorder.h" | 14 #include "SkPictureRecorder.h" |
15 #include "SkStream.h" | 15 #include "SkStream.h" |
16 #include "sk_tool_utils.h" | 16 #include "sk_tool_utils.h" |
| 17 #include "VisualFlags.h" |
17 #include "VisualSKPBench.h" | 18 #include "VisualSKPBench.h" |
18 | 19 |
19 DEFINE_bool(cpu, false, "Run in CPU mode?"); | 20 DEFINE_bool(cpu, false, "Run in CPU mode?"); |
20 DEFINE_string2(match, m, nullptr, | 21 DEFINE_string2(match, m, nullptr, |
21 "[~][^]substring[$] [...] of bench name to run.\n" | 22 "[~][^]substring[$] [...] of bench name to run.\n" |
22 "Multiple matches may be separated by spaces.\n" | 23 "Multiple matches may be separated by spaces.\n" |
23 "~ causes a matching bench to always be skipped\n" | 24 "~ causes a matching bench to always be skipped\n" |
24 "^ requires the start of the bench to match\n" | 25 "^ requires the start of the bench to match\n" |
25 "$ requires the end of the bench to match\n" | 26 "$ requires the end of the bench to match\n" |
26 "^ and $ requires an exact match\n" | 27 "^ and $ requires an exact match\n" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 fIsWarmedUp = true; | 109 fIsWarmedUp = true; |
109 bench = new WarmupBench; | 110 bench = new WarmupBench; |
110 } else { | 111 } else { |
111 // skips non matching benches | 112 // skips non matching benches |
112 while ((bench = this->innerNext()) && | 113 while ((bench = this->innerNext()) && |
113 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName
()) || | 114 (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName
()) || |
114 !bench->isSuitableFor(Benchmark::kGPU_Backend))) { | 115 !bench->isSuitableFor(Benchmark::kGPU_Backend))) { |
115 bench->unref(); | 116 bench->unref(); |
116 } | 117 } |
117 } | 118 } |
| 119 |
| 120 // TODO move this all to --config |
118 if (bench && FLAGS_cpu) { | 121 if (bench && FLAGS_cpu) { |
119 bench = new CpuWrappedBenchmark(bench); | 122 bench = new CpuWrappedBenchmark(bench); |
| 123 } else if (bench && FLAGS_nvpr) { |
| 124 bench = new NvprWrappedBenchmark(bench, 4); |
120 } | 125 } |
121 | 126 |
122 fBenchmark.reset(bench); | 127 fBenchmark.reset(bench); |
123 return fBenchmark; | 128 return fBenchmark; |
124 } | 129 } |
125 | 130 |
126 Benchmark* VisualBenchmarkStream::innerNext() { | 131 Benchmark* VisualBenchmarkStream::innerNext() { |
127 while (fBenches) { | 132 while (fBenches) { |
128 Benchmark* bench = fBenches->factory()(nullptr); | 133 Benchmark* bench = fBenches->factory()(nullptr); |
129 fBenches = fBenches->next(); | 134 fBenches = fBenches->next(); |
(...skipping 24 matching lines...) Expand all Loading... |
154 } | 159 } |
155 | 160 |
156 SkString name = SkOSPath::Basename(path.c_str()); | 161 SkString name = SkOSPath::Basename(path.c_str()); |
157 fSourceType = "skp"; | 162 fSourceType = "skp"; |
158 fBenchType = "playback"; | 163 fBenchType = "playback"; |
159 return new VisualSKPBench(name.c_str(), pic.get()); | 164 return new VisualSKPBench(name.c_str(), pic.get()); |
160 } | 165 } |
161 | 166 |
162 return nullptr; | 167 return nullptr; |
163 } | 168 } |
OLD | NEW |