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

Side by Side Diff: bench/SortBench.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 1 month 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/WriterBench.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 98
99 class SortBench : public SkBenchmark { 99 class SortBench : public SkBenchmark {
100 SkString fName; 100 SkString fName;
101 const Type fType; 101 const Type fType;
102 const SortProc fSortProc; 102 const SortProc fSortProc;
103 SkAutoTMalloc<int> fUnsorted; 103 SkAutoTMalloc<int> fUnsorted;
104 104
105 public: 105 public:
106 SortBench(Type t, SortType s) : fType(t), fSortProc(gSorts[s].fProc) { 106 SortBench(Type t, SortType s) : fType(t), fSortProc(gSorts[s].fProc) {
107 fIsRendering = false;
108 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName); 107 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName);
109 } 108 }
110 109
110 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
111 return backend == kNonRendering_Backend;
112 }
113
111 protected: 114 protected:
112 virtual const char* onGetName() SK_OVERRIDE { 115 virtual const char* onGetName() SK_OVERRIDE {
113 return fName.c_str(); 116 return fName.c_str();
114 } 117 }
115 118
116 // Delayed initialization only done if onDraw will be called. 119 // Delayed initialization only done if onDraw will be called.
117 virtual void onPreDraw() SK_OVERRIDE { 120 virtual void onPreDraw() SK_OVERRIDE {
118 fUnsorted.reset(N); 121 fUnsorted.reset(N);
119 gRec[fType].fProc(fUnsorted.get()); 122 gRec[fType].fProc(fUnsorted.get());
120 } 123 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 DEF_BENCH( return NewSkHeap(kFore); ) 163 DEF_BENCH( return NewSkHeap(kFore); )
161 DEF_BENCH( return NewQSort(kFore); ) 164 DEF_BENCH( return NewQSort(kFore); )
162 165
163 DEF_BENCH( return NewSkQSort(kBack); ) 166 DEF_BENCH( return NewSkQSort(kBack); )
164 DEF_BENCH( return NewSkHeap(kBack); ) 167 DEF_BENCH( return NewSkHeap(kBack); )
165 DEF_BENCH( return NewQSort(kBack); ) 168 DEF_BENCH( return NewQSort(kBack); )
166 169
167 DEF_BENCH( return NewSkQSort(kSame); ) 170 DEF_BENCH( return NewSkQSort(kSame); )
168 DEF_BENCH( return NewSkHeap(kSame); ) 171 DEF_BENCH( return NewSkHeap(kSame); )
169 DEF_BENCH( return NewQSort(kSame); ) 172 DEF_BENCH( return NewQSort(kSame); )
OLDNEW
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | bench/WriterBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698