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

Side by Side Diff: bench/SortBench.cpp

Issue 23876006: Refactoring: get rid of the SkBenchmark void* parameter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « bench/SkBenchmark.cpp ('k') | bench/StrokeBench.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 "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkTSort.h" 10 #include "SkTSort.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 class SortBench : public SkBenchmark { 98 class SortBench : public SkBenchmark {
99 SkString fName; 99 SkString fName;
100 enum { MAX = 100000 }; 100 enum { MAX = 100000 };
101 int fUnsorted[MAX]; 101 int fUnsorted[MAX];
102 int fSorted[MAX]; 102 int fSorted[MAX];
103 int fCount; 103 int fCount;
104 SortProc fSortProc; 104 SortProc fSortProc;
105 105
106 public: 106 public:
107 SortBench(void* param, Type t, int n, SortType s) : INHERITED(param) { 107 SortBench(Type t, int n, SortType s) {
108 if (n > MAX) { 108 if (n > MAX) {
109 n = MAX; 109 n = MAX;
110 } 110 }
111 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName); 111 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName);
112 fCount = n; 112 fCount = n;
113 gRec[t].fProc(fUnsorted, n); 113 gRec[t].fProc(fUnsorted, n);
114 fSortProc = gSorts[s].fProc; 114 fSortProc = gSorts[s].fProc;
115 fIsRendering = false; 115 fIsRendering = false;
116 } 116 }
117 117
(...skipping 13 matching lines...) Expand all
131 #endif 131 #endif
132 } 132 }
133 } 133 }
134 134
135 private: 135 private:
136 typedef SkBenchmark INHERITED; 136 typedef SkBenchmark INHERITED;
137 }; 137 };
138 138
139 /////////////////////////////////////////////////////////////////////////////// 139 ///////////////////////////////////////////////////////////////////////////////
140 140
141 static SkBenchmark* NewSkQSort(void* param, Type t) { 141 static SkBenchmark* NewSkQSort(Type t) {
142 return new SortBench(param, t, N, kSKQSort); 142 return new SortBench(t, N, kSKQSort);
143 } 143 }
144 static SkBenchmark* NewSkHeap(void* param, Type t) { 144 static SkBenchmark* NewSkHeap(Type t) {
145 return new SortBench(param, t, N, kSKHeap); 145 return new SortBench(t, N, kSKHeap);
146 } 146 }
147 static SkBenchmark* NewQSort(void* param, Type t) { 147 static SkBenchmark* NewQSort(Type t) {
148 return new SortBench(param, t, N, kQSort); 148 return new SortBench(t, N, kQSort);
149 } 149 }
150 150
151 DEF_BENCH( return NewSkQSort(p, kRand); ) 151 DEF_BENCH( return NewSkQSort(kRand); )
152 DEF_BENCH( return NewSkHeap(p, kRand); ) 152 DEF_BENCH( return NewSkHeap(kRand); )
153 DEF_BENCH( return NewQSort(p, kRand); ) 153 DEF_BENCH( return NewQSort(kRand); )
154 154
155 DEF_BENCH( return NewSkQSort(p, kRandN); ) 155 DEF_BENCH( return NewSkQSort(kRandN); )
156 DEF_BENCH( return NewSkHeap(p, kRandN); ) 156 DEF_BENCH( return NewSkHeap(kRandN); )
157 DEF_BENCH( return NewQSort(p, kRandN); ) 157 DEF_BENCH( return NewQSort(kRandN); )
158 158
159 DEF_BENCH( return NewSkQSort(p, kFore); ) 159 DEF_BENCH( return NewSkQSort(kFore); )
160 DEF_BENCH( return NewSkHeap(p, kFore); ) 160 DEF_BENCH( return NewSkHeap(kFore); )
161 DEF_BENCH( return NewQSort(p, kFore); ) 161 DEF_BENCH( return NewQSort(kFore); )
162 162
163 DEF_BENCH( return NewSkQSort(p, kBack); ) 163 DEF_BENCH( return NewSkQSort(kBack); )
164 DEF_BENCH( return NewSkHeap(p, kBack); ) 164 DEF_BENCH( return NewSkHeap(kBack); )
165 DEF_BENCH( return NewQSort(p, kBack); ) 165 DEF_BENCH( return NewQSort(kBack); )
166 166
167 DEF_BENCH( return NewSkQSort(p, kSame); ) 167 DEF_BENCH( return NewSkQSort(kSame); )
168 DEF_BENCH( return NewSkHeap(p, kSame); ) 168 DEF_BENCH( return NewSkHeap(kSame); )
169 DEF_BENCH( return NewQSort(p, kSame); ) 169 DEF_BENCH( return NewQSort(kSame); )
OLDNEW
« no previous file with comments | « bench/SkBenchmark.cpp ('k') | bench/StrokeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698