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

Side by Side Diff: bench/SortBench.cpp

Issue 99893003: Simplify benchmark internal API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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/SkipZeroesBench.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 virtual const char* onGetName() SK_OVERRIDE { 115 virtual const char* onGetName() SK_OVERRIDE {
116 return fName.c_str(); 116 return fName.c_str();
117 } 117 }
118 118
119 // Delayed initialization only done if onDraw will be called. 119 // Delayed initialization only done if onDraw will be called.
120 virtual void onPreDraw() SK_OVERRIDE { 120 virtual void onPreDraw() SK_OVERRIDE {
121 fUnsorted.reset(N); 121 fUnsorted.reset(N);
122 gRec[fType].fProc(fUnsorted.get()); 122 gRec[fType].fProc(fUnsorted.get());
123 } 123 }
124 124
125 virtual void onDraw(SkCanvas*) SK_OVERRIDE { 125 virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
126 SkAutoTMalloc<int> sorted(N); 126 SkAutoTMalloc<int> sorted(N);
127 for (int i = 0; i < this->getLoops(); i++) { 127 for (int i = 0; i < loops; i++) {
128 memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int)); 128 memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int));
129 fSortProc(sorted.get()); 129 fSortProc(sorted.get());
130 #ifdef SK_DEBUG 130 #ifdef SK_DEBUG
131 for (int j = 1; j < N; ++j) { 131 for (int j = 1; j < N; ++j) {
132 SkASSERT(sorted[j - 1] <= sorted[j]); 132 SkASSERT(sorted[j - 1] <= sorted[j]);
133 } 133 }
134 #endif 134 #endif
135 } 135 }
136 } 136 }
137 137
(...skipping 25 matching lines...) Expand all
163 DEF_BENCH( return NewSkHeap(kFore); ) 163 DEF_BENCH( return NewSkHeap(kFore); )
164 DEF_BENCH( return NewQSort(kFore); ) 164 DEF_BENCH( return NewQSort(kFore); )
165 165
166 DEF_BENCH( return NewSkQSort(kBack); ) 166 DEF_BENCH( return NewSkQSort(kBack); )
167 DEF_BENCH( return NewSkHeap(kBack); ) 167 DEF_BENCH( return NewSkHeap(kBack); )
168 DEF_BENCH( return NewQSort(kBack); ) 168 DEF_BENCH( return NewQSort(kBack); )
169 169
170 DEF_BENCH( return NewSkQSort(kSame); ) 170 DEF_BENCH( return NewSkQSort(kSame); )
171 DEF_BENCH( return NewSkHeap(kSame); ) 171 DEF_BENCH( return NewSkHeap(kSame); )
172 DEF_BENCH( return NewQSort(kSame); ) 172 DEF_BENCH( return NewQSort(kSame); )
OLDNEW
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | bench/StrokeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698