OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 // This tests a Gr class | 8 // This tests a Gr class |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 #endif | 25 #endif |
26 static GrMemoryPool gBenchPool; | 26 static GrMemoryPool gBenchPool; |
27 }; | 27 }; |
28 GrMemoryPool A::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); | 28 GrMemoryPool A::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); |
29 | 29 |
30 /** | 30 /** |
31 * This benchmark creates and deletes objects in stack order | 31 * This benchmark creates and deletes objects in stack order |
32 */ | 32 */ |
33 class GrMemoryPoolBenchStack : public Benchmark { | 33 class GrMemoryPoolBenchStack : public Benchmark { |
34 public: | 34 public: |
35 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 35 bool isSuitableFor(Backend backend) SK_OVERRIDE { |
36 return backend == kNonRendering_Backend; | 36 return backend == kNonRendering_Backend; |
37 } | 37 } |
38 | 38 |
39 protected: | 39 protected: |
40 virtual const char* onGetName() { | 40 virtual const char* onGetName() { |
41 return "grmemorypool_stack"; | 41 return "grmemorypool_stack"; |
42 } | 42 } |
43 | 43 |
44 virtual void onDraw(const int loops, SkCanvas*) { | 44 virtual void onDraw(const int loops, SkCanvas*) { |
45 SkRandom r; | 45 SkRandom r; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 #endif | 87 #endif |
88 static GrMemoryPool gBenchPool; | 88 static GrMemoryPool gBenchPool; |
89 }; | 89 }; |
90 GrMemoryPool B::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); | 90 GrMemoryPool B::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); |
91 | 91 |
92 /** | 92 /** |
93 * This benchmark creates objects and deletes them in random order | 93 * This benchmark creates objects and deletes them in random order |
94 */ | 94 */ |
95 class GrMemoryPoolBenchRandom : public Benchmark { | 95 class GrMemoryPoolBenchRandom : public Benchmark { |
96 public: | 96 public: |
97 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 97 bool isSuitableFor(Backend backend) SK_OVERRIDE { |
98 return backend == kNonRendering_Backend; | 98 return backend == kNonRendering_Backend; |
99 } | 99 } |
100 | 100 |
101 protected: | 101 protected: |
102 virtual const char* onGetName() { | 102 virtual const char* onGetName() { |
103 return "grmemorypool_random"; | 103 return "grmemorypool_random"; |
104 } | 104 } |
105 | 105 |
106 virtual void onDraw(const int loops, SkCanvas*) { | 106 virtual void onDraw(const int loops, SkCanvas*) { |
107 SkRandom r; | 107 SkRandom r; |
(...skipping 27 matching lines...) Expand all Loading... |
135 GrMemoryPool C::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); | 135 GrMemoryPool C::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); |
136 | 136 |
137 /** | 137 /** |
138 * This benchmark creates objects and deletes them in queue order | 138 * This benchmark creates objects and deletes them in queue order |
139 */ | 139 */ |
140 class GrMemoryPoolBenchQueue : public Benchmark { | 140 class GrMemoryPoolBenchQueue : public Benchmark { |
141 enum { | 141 enum { |
142 M = 4 * (1 << 10), | 142 M = 4 * (1 << 10), |
143 }; | 143 }; |
144 public: | 144 public: |
145 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 145 bool isSuitableFor(Backend backend) SK_OVERRIDE { |
146 return backend == kNonRendering_Backend; | 146 return backend == kNonRendering_Backend; |
147 } | 147 } |
148 | 148 |
149 protected: | 149 protected: |
150 virtual const char* onGetName() { | 150 virtual const char* onGetName() { |
151 return "grmemorypool_queue"; | 151 return "grmemorypool_queue"; |
152 } | 152 } |
153 | 153 |
154 virtual void onDraw(const int loops, SkCanvas*) { | 154 virtual void onDraw(const int loops, SkCanvas*) { |
155 SkRandom r; | 155 SkRandom r; |
(...skipping 13 matching lines...) Expand all Loading... |
169 typedef Benchmark INHERITED; | 169 typedef Benchmark INHERITED; |
170 }; | 170 }; |
171 | 171 |
172 /////////////////////////////////////////////////////////////////////////////// | 172 /////////////////////////////////////////////////////////////////////////////// |
173 | 173 |
174 DEF_BENCH( return new GrMemoryPoolBenchStack(); ) | 174 DEF_BENCH( return new GrMemoryPoolBenchStack(); ) |
175 DEF_BENCH( return new GrMemoryPoolBenchRandom(); ) | 175 DEF_BENCH( return new GrMemoryPoolBenchRandom(); ) |
176 DEF_BENCH( return new GrMemoryPoolBenchQueue(); ) | 176 DEF_BENCH( return new GrMemoryPoolBenchQueue(); ) |
177 | 177 |
178 #endif | 178 #endif |
OLD | NEW |