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

Side by Side Diff: bench/RTreeBench.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 1 month 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/PictureRecordBench.cpp ('k') | bench/RefCntBench.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 2012 Google Inc. 3 * Copyright 2012 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 #include "SkBenchmark.h" 9 #include "SkBenchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 16 matching lines...) Expand all
27 SkBBoxHierarchy* tree) 27 SkBBoxHierarchy* tree)
28 : fTree(tree) 28 : fTree(tree)
29 , fProc(proc) 29 , fProc(proc)
30 , fBulkLoad(bulkLoad) { 30 , fBulkLoad(bulkLoad) {
31 fName.append("rtree_"); 31 fName.append("rtree_");
32 fName.append(name); 32 fName.append(name);
33 fName.append("_build"); 33 fName.append("_build");
34 if (fBulkLoad) { 34 if (fBulkLoad) {
35 fName.append("_bulk"); 35 fName.append("_bulk");
36 } 36 }
37 fIsRendering = false;
38 } 37 }
38
39 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
40 return backend == kNonRendering_Backend;
41 }
42
39 virtual ~BBoxBuildBench() { 43 virtual ~BBoxBuildBench() {
40 fTree->unref(); 44 fTree->unref();
41 } 45 }
42 protected: 46 protected:
43 virtual const char* onGetName() SK_OVERRIDE { 47 virtual const char* onGetName() SK_OVERRIDE {
44 return fName.c_str(); 48 return fName.c_str();
45 } 49 }
46 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 50 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
47 SkRandom rand; 51 SkRandom rand;
48 for (int i = 0; i < this->getLoops(); ++i) { 52 for (int i = 0; i < this->getLoops(); ++i) {
(...skipping 28 matching lines...) Expand all
77 : fTree(tree) 81 : fTree(tree)
78 , fProc(proc) 82 , fProc(proc)
79 , fBulkLoad(bulkLoad) 83 , fBulkLoad(bulkLoad)
80 , fQuery(q) { 84 , fQuery(q) {
81 fName.append("rtree_"); 85 fName.append("rtree_");
82 fName.append(name); 86 fName.append(name);
83 fName.append("_query"); 87 fName.append("_query");
84 if (fBulkLoad) { 88 if (fBulkLoad) {
85 fName.append("_bulk"); 89 fName.append("_bulk");
86 } 90 }
87 fIsRendering = false;
88 } 91 }
92
93 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
94 return backend == kNonRendering_Backend;
95 }
96
89 virtual ~BBoxQueryBench() { 97 virtual ~BBoxQueryBench() {
90 fTree->unref(); 98 fTree->unref();
91 } 99 }
92 protected: 100 protected:
93 virtual const char* onGetName() SK_OVERRIDE { 101 virtual const char* onGetName() SK_OVERRIDE {
94 return fName.c_str(); 102 return fName.c_str();
95 } 103 }
96 virtual void onPreDraw() SK_OVERRIDE { 104 virtual void onPreDraw() SK_OVERRIDE {
97 SkRandom rand; 105 SkRandom rand;
98 for (int j = 0; j < NUM_QUERY_RECTS; ++j) { 106 for (int j = 0; j < NUM_QUERY_RECTS; ++j) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 &make_concentric_rects_increasing, true, SkRTree::Create(5 , 16, 1, false))); 260 &make_concentric_rects_increasing, true, SkRTree::Create(5 , 16, 1, false)));
253 ) 261 )
254 DEF_BENCH( 262 DEF_BENCH(
255 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr easing, true, 263 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr easing, true,
256 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)) ); 264 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)) );
257 ) 265 )
258 DEF_BENCH( 266 DEF_BENCH(
259 return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_ rects_increasing, true, 267 return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_ rects_increasing, true,
260 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false))); 268 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
261 ) 269 )
OLDNEW
« no previous file with comments | « bench/PictureRecordBench.cpp ('k') | bench/RefCntBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698