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

Side by Side Diff: bench/RefCntBench.cpp

Issue 2183473005: Clean up some unused atomic routines. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | include/private/SkAtomics.h » ('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 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 #include <memory> 7 #include <memory>
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkAtomics.h" 9 #include "SkAtomics.h"
10 #include "SkRefCnt.h" 10 #include "SkRefCnt.h"
(...skipping 20 matching lines...) Expand all
31 for (int i = 0; i < loops; ++i) { 31 for (int i = 0; i < loops; ++i) {
32 sk_atomic_inc(&fX); 32 sk_atomic_inc(&fX);
33 } 33 }
34 } 34 }
35 35
36 private: 36 private:
37 int32_t fX; 37 int32_t fX;
38 typedef Benchmark INHERITED; 38 typedef Benchmark INHERITED;
39 }; 39 };
40 40
41 class AtomicInc64 : public Benchmark {
42 public:
43 AtomicInc64() : fX(0) {}
44
45 bool isSuitableFor(Backend backend) override {
46 return backend == kNonRendering_Backend;
47 }
48
49 protected:
50 const char* onGetName() override {
51 return "atomic_inc_64";
52 }
53
54 void onDraw(int loops, SkCanvas*) override {
55 for (int i = 0; i < loops; ++i) {
56 sk_atomic_inc(&fX);
57 }
58 }
59
60 private:
61 int64_t fX;
62 typedef Benchmark INHERITED;
63 };
64
65 class RefCntBench_Stack : public Benchmark { 41 class RefCntBench_Stack : public Benchmark {
66 public: 42 public:
67 bool isSuitableFor(Backend backend) override { 43 bool isSuitableFor(Backend backend) override {
68 return backend == kNonRendering_Backend; 44 return backend == kNonRendering_Backend;
69 } 45 }
70 46
71 protected: 47 protected:
72 const char* onGetName() override { 48 const char* onGetName() override {
73 return "ref_cnt_stack"; 49 return "ref_cnt_stack";
74 } 50 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 207 }
232 } 208 }
233 209
234 private: 210 private:
235 typedef Benchmark INHERITED; 211 typedef Benchmark INHERITED;
236 }; 212 };
237 213
238 /////////////////////////////////////////////////////////////////////////////// 214 ///////////////////////////////////////////////////////////////////////////////
239 215
240 DEF_BENCH( return new AtomicInc32(); ) 216 DEF_BENCH( return new AtomicInc32(); )
241 DEF_BENCH( return new AtomicInc64(); )
242 217
243 DEF_BENCH( return new RefCntBench_Stack(); ) 218 DEF_BENCH( return new RefCntBench_Stack(); )
244 DEF_BENCH( return new RefCntBench_Heap(); ) 219 DEF_BENCH( return new RefCntBench_Heap(); )
245 DEF_BENCH( return new RefCntBench_New(); ) 220 DEF_BENCH( return new RefCntBench_New(); )
246 221
247 DEF_BENCH( return new WeakRefCntBench_Stack(); ) 222 DEF_BENCH( return new WeakRefCntBench_Stack(); )
248 DEF_BENCH( return new WeakRefCntBench_Heap(); ) 223 DEF_BENCH( return new WeakRefCntBench_Heap(); )
249 DEF_BENCH( return new WeakRefCntBench_New(); ) 224 DEF_BENCH( return new WeakRefCntBench_New(); )
OLDNEW
« no previous file with comments | « no previous file | include/private/SkAtomics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698