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

Side by Side Diff: bench/MemsetBench.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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/MemoryBench.cpp ('k') | bench/MergeBench.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 2013 Google Inc. 2 * Copyright 2013 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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 17 matching lines...) Expand all
28 }; 28 };
29 29
30 public: 30 public:
31 MemsetBench(MemsetType type, int minSize, int maxSize) { 31 MemsetBench(MemsetType type, int minSize, int maxSize) {
32 SkASSERT((minSize < maxSize) && (maxSize <= kBufferSize)); 32 SkASSERT((minSize < maxSize) && (maxSize <= kBufferSize));
33 fMinSize = minSize; 33 fMinSize = minSize;
34 fMaxSize = maxSize; 34 fMaxSize = maxSize;
35 fName.printf("memset%d_%d_%d", type, minSize, maxSize); 35 fName.printf("memset%d_%d_%d", type, minSize, maxSize);
36 } 36 }
37 37
38 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 38 bool isSuitableFor(Backend backend) SK_OVERRIDE {
39 return backend == kNonRendering_Backend; 39 return backend == kNonRendering_Backend;
40 } 40 }
41 41
42 virtual void performTest() = 0; 42 virtual void performTest() = 0;
43 43
44 protected: 44 protected:
45 virtual const char* onGetName() SK_OVERRIDE { 45 const char* onGetName() SK_OVERRIDE {
46 return fName.c_str(); 46 return fName.c_str();
47 } 47 }
48 48
49 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 49 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
50 for (int i = 0; i < loops; ++i) { 50 for (int i = 0; i < loops; ++i) {
51 this->performTest(); 51 this->performTest();
52 } 52 }
53 } 53 }
54 54
55 private: 55 private:
56 typedef Benchmark INHERITED; 56 typedef Benchmark INHERITED;
57 }; 57 };
58 58
59 class Memset32Bench : public MemsetBench { 59 class Memset32Bench : public MemsetBench {
60 uint32_t kBuffer[kBufferSize + 3]; 60 uint32_t kBuffer[kBufferSize + 3];
61 public: 61 public:
62 Memset32Bench(int minSize, int maxSize) 62 Memset32Bench(int minSize, int maxSize)
63 : INHERITED(MEMSET32, minSize, maxSize) {} 63 : INHERITED(MEMSET32, minSize, maxSize) {}
64 64
65 protected: 65 protected:
66 virtual void performTest() SK_OVERRIDE { 66 void performTest() SK_OVERRIDE {
67 for(int j = fMinSize; j < fMaxSize; ++j){ 67 for(int j = fMinSize; j < fMaxSize; ++j){
68 sk_memset32(kBuffer, VALUE32, j); 68 sk_memset32(kBuffer, VALUE32, j);
69 sk_memset32(kBuffer + 1, VALUE32, j); 69 sk_memset32(kBuffer + 1, VALUE32, j);
70 sk_memset32(kBuffer + 2, VALUE32, j); 70 sk_memset32(kBuffer + 2, VALUE32, j);
71 sk_memset32(kBuffer + 3, VALUE32, j); 71 sk_memset32(kBuffer + 3, VALUE32, j);
72 } 72 }
73 } 73 }
74 private: 74 private:
75 typedef MemsetBench INHERITED; 75 typedef MemsetBench INHERITED;
76 }; 76 };
77 77
78 class Memset16Bench : public MemsetBench { 78 class Memset16Bench : public MemsetBench {
79 uint16_t kBuffer[kBufferSize + 7]; 79 uint16_t kBuffer[kBufferSize + 7];
80 public: 80 public:
81 Memset16Bench(int minSize, int maxSize) 81 Memset16Bench(int minSize, int maxSize)
82 : INHERITED(MEMSET16, minSize, maxSize) {} 82 : INHERITED(MEMSET16, minSize, maxSize) {}
83 83
84 protected: 84 protected:
85 virtual void performTest() SK_OVERRIDE { 85 void performTest() SK_OVERRIDE {
86 for(int j = fMinSize; j < fMaxSize; ++j){ 86 for(int j = fMinSize; j < fMaxSize; ++j){
87 sk_memset16(kBuffer, VALUE16, j); 87 sk_memset16(kBuffer, VALUE16, j);
88 sk_memset16(kBuffer + 1, VALUE16, j); 88 sk_memset16(kBuffer + 1, VALUE16, j);
89 sk_memset16(kBuffer + 2, VALUE16, j); 89 sk_memset16(kBuffer + 2, VALUE16, j);
90 sk_memset16(kBuffer + 3, VALUE16, j); 90 sk_memset16(kBuffer + 3, VALUE16, j);
91 sk_memset16(kBuffer + 4, VALUE16, j); 91 sk_memset16(kBuffer + 4, VALUE16, j);
92 sk_memset16(kBuffer + 5, VALUE16, j); 92 sk_memset16(kBuffer + 5, VALUE16, j);
93 sk_memset16(kBuffer + 6, VALUE16, j); 93 sk_memset16(kBuffer + 6, VALUE16, j);
94 sk_memset16(kBuffer + 7, VALUE16, j); 94 sk_memset16(kBuffer + 7, VALUE16, j);
95 } 95 }
(...skipping 10 matching lines...) Expand all
106 DEF_BENCH(return new Memset32Bench(3000, 4000);) 106 DEF_BENCH(return new Memset32Bench(3000, 4000);)
107 DEF_BENCH(return new Memset32Bench(4000, 5000);) 107 DEF_BENCH(return new Memset32Bench(4000, 5000);)
108 108
109 DEF_BENCH(return new Memset16Bench(1, 600);) 109 DEF_BENCH(return new Memset16Bench(1, 600);)
110 DEF_BENCH(return new Memset16Bench(600, 800);) 110 DEF_BENCH(return new Memset16Bench(600, 800);)
111 DEF_BENCH(return new Memset16Bench(800, 1000);) 111 DEF_BENCH(return new Memset16Bench(800, 1000);)
112 DEF_BENCH(return new Memset16Bench(1000, 2000);) 112 DEF_BENCH(return new Memset16Bench(1000, 2000);)
113 DEF_BENCH(return new Memset16Bench(2000, 3000);) 113 DEF_BENCH(return new Memset16Bench(2000, 3000);)
114 DEF_BENCH(return new Memset16Bench(3000, 4000);) 114 DEF_BENCH(return new Memset16Bench(3000, 4000);)
115 DEF_BENCH(return new Memset16Bench(4000, 5000);) 115 DEF_BENCH(return new Memset16Bench(4000, 5000);)
OLDNEW
« no previous file with comments | « bench/MemoryBench.cpp ('k') | bench/MergeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698