OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkFloatBits.h" | 9 #include "SkFloatBits.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 virtual void performTest() = 0; | 25 virtual void performTest() = 0; |
26 | 26 |
27 protected: | 27 protected: |
28 virtual int mulLoopCount() const { return 1; } | 28 virtual int mulLoopCount() const { return 1; } |
29 | 29 |
30 const char* onGetName() override { | 30 const char* onGetName() override { |
31 return fName.c_str(); | 31 return fName.c_str(); |
32 } | 32 } |
33 | 33 |
34 void onDraw(const int loops, SkCanvas* canvas) override { | 34 void onDraw(int loops, SkCanvas* canvas) override { |
35 for (int i = 0; i < loops; i++) { | 35 for (int i = 0; i < loops; i++) { |
36 this->performTest(); | 36 this->performTest(); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 typedef Benchmark INHERITED; | 41 typedef Benchmark INHERITED; |
42 }; | 42 }; |
43 | 43 |
44 // having unknown values in our arrays can throw off the timing a lot, perhaps | 44 // having unknown values in our arrays can throw off the timing a lot, perhaps |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 bool isSuitableFor(Backend backend) override { | 143 bool isSuitableFor(Backend backend) override { |
144 return backend == kNonRendering_Backend; | 144 return backend == kNonRendering_Backend; |
145 } | 145 } |
146 | 146 |
147 protected: | 147 protected: |
148 const char* onGetName() override { | 148 const char* onGetName() override { |
149 return "rect_bounds"; | 149 return "rect_bounds"; |
150 } | 150 } |
151 | 151 |
152 void onDraw(const int loops, SkCanvas* canvas) override { | 152 void onDraw(int loops, SkCanvas* canvas) override { |
153 SkRect r; | 153 SkRect r; |
154 for (int i = 0; i < loops; ++i) { | 154 for (int i = 0; i < loops; ++i) { |
155 for (int i = 0; i < 1000; ++i) { | 155 for (int i = 0; i < 1000; ++i) { |
156 r.set(fPts, PTS); | 156 r.set(fPts, PTS); |
157 } | 157 } |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 private: | 161 private: |
162 typedef Benchmark INHERITED; | 162 typedef Benchmark INHERITED; |
163 }; | 163 }; |
164 | 164 |
165 /////////////////////////////////////////////////////////////////////////////// | 165 /////////////////////////////////////////////////////////////////////////////// |
166 | 166 |
167 DEF_BENCH( return new FloatComparisonBench(); ) | 167 DEF_BENCH( return new FloatComparisonBench(); ) |
168 DEF_BENCH( return new ForcedIntComparisonBench(); ) | 168 DEF_BENCH( return new ForcedIntComparisonBench(); ) |
169 DEF_BENCH( return new RectBoundsBench(); ) | 169 DEF_BENCH( return new RectBoundsBench(); ) |
170 DEF_BENCH( return new IsFiniteScalarBench(); ) | 170 DEF_BENCH( return new IsFiniteScalarBench(); ) |
OLD | NEW |