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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 99893003: Simplify benchmark internal API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « bench/GrMemoryPoolBench.cpp ('k') | bench/GradientBench.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 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 8
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 10
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 public: 176 public:
177 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 177 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
178 return backend == kGPU_Backend; 178 return backend == kGPU_Backend;
179 } 179 }
180 180
181 protected: 181 protected:
182 virtual const char* onGetName() SK_OVERRIDE { 182 virtual const char* onGetName() SK_OVERRIDE {
183 return "grresourcecache_add"; 183 return "grresourcecache_add";
184 } 184 }
185 185
186 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 186 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
187 GrGpu* gpu = canvas->getGrContext()->getGpu(); 187 GrGpu* gpu = canvas->getGrContext()->getGpu();
188 188
189 for (int i = 0; i < this->getLoops(); ++i) { 189 for (int i = 0; i < loops; ++i) {
190 GrResourceCache cache(CACHE_SIZE_COUNT, CACHE_SIZE_BYTES); 190 GrResourceCache cache(CACHE_SIZE_COUNT, CACHE_SIZE_BYTES);
191 populate_cache(&cache, gpu, DUPLICATE_COUNT); 191 populate_cache(&cache, gpu, DUPLICATE_COUNT);
192 populate_cache(&cache, gpu, RESOURCE_COUNT); 192 populate_cache(&cache, gpu, RESOURCE_COUNT);
193 193
194 // Check that cache works. 194 // Check that cache works.
195 for (int k = 0; k < RESOURCE_COUNT; k += 33) { 195 for (int k = 0; k < RESOURCE_COUNT; k += 33) {
196 check_cache_contents_or_die(&cache, k); 196 check_cache_contents_or_die(&cache, k);
197 } 197 }
198 cache.purgeAllUnlocked(); 198 cache.purgeAllUnlocked();
199 } 199 }
(...skipping 12 matching lines...) Expand all
212 public: 212 public:
213 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 213 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
214 return backend == kGPU_Backend; 214 return backend == kGPU_Backend;
215 } 215 }
216 216
217 protected: 217 protected:
218 virtual const char* onGetName() SK_OVERRIDE { 218 virtual const char* onGetName() SK_OVERRIDE {
219 return "grresourcecache_find"; 219 return "grresourcecache_find";
220 } 220 }
221 221
222 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 222 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
223 GrGpu* gpu = canvas->getGrContext()->getGpu(); 223 GrGpu* gpu = canvas->getGrContext()->getGpu();
224 GrResourceCache cache(CACHE_SIZE_COUNT, CACHE_SIZE_BYTES); 224 GrResourceCache cache(CACHE_SIZE_COUNT, CACHE_SIZE_BYTES);
225 populate_cache(&cache, gpu, DUPLICATE_COUNT); 225 populate_cache(&cache, gpu, DUPLICATE_COUNT);
226 populate_cache(&cache, gpu, RESOURCE_COUNT); 226 populate_cache(&cache, gpu, RESOURCE_COUNT);
227 227
228 for (int i = 0; i < this->getLoops(); ++i) { 228 for (int i = 0; i < loops; ++i) {
229 for (int k = 0; k < RESOURCE_COUNT; ++k) { 229 for (int k = 0; k < RESOURCE_COUNT; ++k) {
230 check_cache_contents_or_die(&cache, k); 230 check_cache_contents_or_die(&cache, k);
231 } 231 }
232 } 232 }
233 } 233 }
234 234
235 private: 235 private:
236 typedef SkBenchmark INHERITED; 236 typedef SkBenchmark INHERITED;
237 }; 237 };
238 238
239 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) 239 DEF_BENCH( return new GrResourceCacheBenchAdd(); )
240 DEF_BENCH( return new GrResourceCacheBenchFind(); ) 240 DEF_BENCH( return new GrResourceCacheBenchFind(); )
241 241
242 #endif 242 #endif
OLDNEW
« no previous file with comments | « bench/GrMemoryPoolBench.cpp ('k') | bench/GradientBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698