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

Side by Side Diff: bench/GrOrderedSetBench.cpp

Issue 347823004: Remove Sk prefix from some bench classes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkGMBench -> GMBench Created 6 years, 6 months 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
« no previous file with comments | « bench/GrMemoryPoolBench.cpp ('k') | bench/GrResourceCacheBench.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 #include "SkBenchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
11 #include "SkString.h" 11 #include "SkString.h"
12 #if SK_SUPPORT_GPU 12 #if SK_SUPPORT_GPU
13 #include "GrOrderedSet.h" 13 #include "GrOrderedSet.h"
14 14
15 static const int NUM_ELEMENTS = 1000; 15 static const int NUM_ELEMENTS = 1000;
16 16
17 // Time how long it takes to build a set 17 // Time how long it takes to build a set
18 class GrOrderedSetBuildBench : public SkBenchmark { 18 class GrOrderedSetBuildBench : public Benchmark {
19 public: 19 public:
20 GrOrderedSetBuildBench() { 20 GrOrderedSetBuildBench() {
21 fName.append("ordered_set_build"); 21 fName.append("ordered_set_build");
22 } 22 }
23 23
24 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 24 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
25 return kNonRendering_Backend == backend; 25 return kNonRendering_Backend == backend;
26 } 26 }
27 27
28 virtual ~GrOrderedSetBuildBench() {} 28 virtual ~GrOrderedSetBuildBench() {}
(...skipping 16 matching lines...) Expand all
45 for (int j = 0; j < NUM_ELEMENTS; ++j) { 45 for (int j = 0; j < NUM_ELEMENTS; ++j) {
46 set.insert(fData[j]); 46 set.insert(fData[j]);
47 } 47 }
48 set.reset(); 48 set.reset();
49 } 49 }
50 } 50 }
51 51
52 private: 52 private:
53 SkString fName; 53 SkString fName;
54 int fData[NUM_ELEMENTS]; 54 int fData[NUM_ELEMENTS];
55 typedef SkBenchmark INHERITED; 55 typedef Benchmark INHERITED;
56 }; 56 };
57 57
58 // Time how long it takes to find elements in a set 58 // Time how long it takes to find elements in a set
59 class GrOrderedSetFindBench : public SkBenchmark { 59 class GrOrderedSetFindBench : public Benchmark {
60 public: 60 public:
61 GrOrderedSetFindBench() { 61 GrOrderedSetFindBench() {
62 fName.append("ordered_set_find"); 62 fName.append("ordered_set_find");
63 } 63 }
64 64
65 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 65 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
66 return kNonRendering_Backend == backend; 66 return kNonRendering_Backend == backend;
67 } 67 }
68 68
69 virtual ~GrOrderedSetFindBench() {} 69 virtual ~GrOrderedSetFindBench() {}
(...skipping 16 matching lines...) Expand all
86 for (int j = 0; j < NUM_ELEMENTS; ++j) { 86 for (int j = 0; j < NUM_ELEMENTS; ++j) {
87 fSet.find(fData[j]); 87 fSet.find(fData[j]);
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 private: 92 private:
93 SkString fName; 93 SkString fName;
94 int fData[NUM_ELEMENTS]; 94 int fData[NUM_ELEMENTS];
95 GrOrderedSet<int> fSet; 95 GrOrderedSet<int> fSet;
96 typedef SkBenchmark INHERITED; 96 typedef Benchmark INHERITED;
97 }; 97 };
98 98
99 // Time how long it takes to iterate over and remove all elements from set 99 // Time how long it takes to iterate over and remove all elements from set
100 class GrOrderedSetRemoveBench : public SkBenchmark { 100 class GrOrderedSetRemoveBench : public Benchmark {
101 public: 101 public:
102 GrOrderedSetRemoveBench() { 102 GrOrderedSetRemoveBench() {
103 fName.append("ordered_set_remove"); 103 fName.append("ordered_set_remove");
104 } 104 }
105 105
106 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 106 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
107 return kNonRendering_Backend == backend; 107 return kNonRendering_Backend == backend;
108 } 108 }
109 109
110 virtual ~GrOrderedSetRemoveBench() {} 110 virtual ~GrOrderedSetRemoveBench() {}
(...skipping 19 matching lines...) Expand all
130 } 130 }
131 for (int j = 0; j < NUM_ELEMENTS; ++j) { 131 for (int j = 0; j < NUM_ELEMENTS; ++j) {
132 testSet.remove(testSet.find(j)); 132 testSet.remove(testSet.find(j));
133 } 133 }
134 } 134 }
135 } 135 }
136 136
137 private: 137 private:
138 SkString fName; 138 SkString fName;
139 GrOrderedSet<int> fSet; 139 GrOrderedSet<int> fSet;
140 typedef SkBenchmark INHERITED; 140 typedef Benchmark INHERITED;
141 }; 141 };
142 142
143 /////////////////////////////////////////////////////////////////////////////// 143 ///////////////////////////////////////////////////////////////////////////////
144 144
145 DEF_BENCH(return SkNEW_ARGS(GrOrderedSetBuildBench, ());) 145 DEF_BENCH(return SkNEW_ARGS(GrOrderedSetBuildBench, ());)
146 DEF_BENCH(return SkNEW_ARGS(GrOrderedSetFindBench, ());) 146 DEF_BENCH(return SkNEW_ARGS(GrOrderedSetFindBench, ());)
147 DEF_BENCH(return SkNEW_ARGS(GrOrderedSetRemoveBench, ());) 147 DEF_BENCH(return SkNEW_ARGS(GrOrderedSetRemoveBench, ());)
148 #endif 148 #endif
OLDNEW
« no previous file with comments | « bench/GrMemoryPoolBench.cpp ('k') | bench/GrResourceCacheBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698