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

Side by Side Diff: bench/SortBench.cpp

Issue 23478013: Major bench refactoring. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: merge with head agani 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 fSortProc = gSorts[s].fProc; 114 fSortProc = gSorts[s].fProc;
115 fIsRendering = false; 115 fIsRendering = false;
116 } 116 }
117 117
118 protected: 118 protected:
119 virtual const char* onGetName() SK_OVERRIDE { 119 virtual const char* onGetName() SK_OVERRIDE {
120 return fName.c_str(); 120 return fName.c_str();
121 } 121 }
122 122
123 virtual void onDraw(SkCanvas*) { 123 virtual void onDraw(SkCanvas*) {
124 int n = SkBENCHLOOP(200); 124 for (int i = 0; i < this->getLoops(); i++) {
125 for (int i = 0; i < n; i++) {
126 memcpy(fSorted, fUnsorted, fCount * sizeof(int)); 125 memcpy(fSorted, fUnsorted, fCount * sizeof(int));
127 fSortProc(fSorted, fCount); 126 fSortProc(fSorted, fCount);
128 #ifdef SK_DEBUG 127 #ifdef SK_DEBUG
129 for (int j = 1; j < fCount; ++j) { 128 for (int j = 1; j < fCount; ++j) {
130 SkASSERT(fSorted[j - 1] <= fSorted[j]); 129 SkASSERT(fSorted[j - 1] <= fSorted[j]);
131 } 130 }
132 #endif 131 #endif
133 } 132 }
134 } 133 }
135 134
(...skipping 25 matching lines...) Expand all
161 DEF_BENCH( return NewSkHeap(p, kFore); ) 160 DEF_BENCH( return NewSkHeap(p, kFore); )
162 DEF_BENCH( return NewQSort(p, kFore); ) 161 DEF_BENCH( return NewQSort(p, kFore); )
163 162
164 DEF_BENCH( return NewSkQSort(p, kBack); ) 163 DEF_BENCH( return NewSkQSort(p, kBack); )
165 DEF_BENCH( return NewSkHeap(p, kBack); ) 164 DEF_BENCH( return NewSkHeap(p, kBack); )
166 DEF_BENCH( return NewQSort(p, kBack); ) 165 DEF_BENCH( return NewQSort(p, kBack); )
167 166
168 DEF_BENCH( return NewSkQSort(p, kSame); ) 167 DEF_BENCH( return NewSkQSort(p, kSame); )
169 DEF_BENCH( return NewSkHeap(p, kSame); ) 168 DEF_BENCH( return NewSkHeap(p, kSame); )
170 DEF_BENCH( return NewQSort(p, kSame); ) 169 DEF_BENCH( return NewQSort(p, 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