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

Side by Side Diff: bench/ChartBench.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/BlurRectBench.cpp ('k') | bench/ChecksumBench.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBenchmark.h" 9 #include "SkBenchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (sizeChanged) { 120 if (sizeChanged) {
121 int dataPointCount = SkMax32(fSize.fWidth / kPixelsPerTick + 1, 2); 121 int dataPointCount = SkMax32(fSize.fWidth / kPixelsPerTick + 1, 2);
122 122
123 for (int i = 0; i < kNumGraphs; ++i) { 123 for (int i = 0; i < kNumGraphs; ++i) {
124 SkScalar y = (kNumGraphs - i) * (height - ySpread) / (kNumGraphs + 1); 124 SkScalar y = (kNumGraphs - i) * (height - ySpread) / (kNumGraphs + 1);
125 fData[i].reset(); 125 fData[i].reset();
126 gen_data(y, ySpread, dataPointCount, fData + i); 126 gen_data(y, ySpread, dataPointCount, fData + i);
127 } 127 }
128 } 128 }
129 129
130 for (int frame = 0; frame < kFramesPerRun; ++frame) { 130 for (int frame = 0; frame < this->getLoops(); ++frame) {
131 131
132 canvas->clear(0xFFE0F0E0); 132 canvas->clear(0xFFE0F0E0);
133 133
134 static SkRandom colorRand; 134 static SkRandom colorRand;
135 static SkColor gColors[kNumGraphs] = { 0x0 }; 135 static SkColor gColors[kNumGraphs] = { 0x0 };
136 if (0 == gColors[0]) { 136 if (0 == gColors[0]) {
137 for (int i = 0; i < kNumGraphs; ++i) { 137 for (int i = 0; i < kNumGraphs; ++i) {
138 gColors[i] = colorRand.nextU() | 0xff000000; 138 gColors[i] = colorRand.nextU() | 0xff000000;
139 } 139 }
140 } 140 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 fShift += kShiftPerFrame; 177 fShift += kShiftPerFrame;
178 } 178 }
179 } 179 }
180 180
181 private: 181 private:
182 enum { 182 enum {
183 kNumGraphs = 5, 183 kNumGraphs = 5,
184 kPixelsPerTick = 3, 184 kPixelsPerTick = 3,
185 kShiftPerFrame = 1, 185 kShiftPerFrame = 1,
186
187 kFramesPerRun = SkBENCHLOOP(5),
188 }; 186 };
189 int fShift; 187 int fShift;
190 SkISize fSize; 188 SkISize fSize;
191 SkTDArray<SkScalar> fData[kNumGraphs]; 189 SkTDArray<SkScalar> fData[kNumGraphs];
192 bool fAA; 190 bool fAA;
193 191
194 typedef SkBenchmark INHERITED; 192 typedef SkBenchmark INHERITED;
195 }; 193 };
196 194
197 ////////////////////////////////////////////////////////////////////////////// 195 //////////////////////////////////////////////////////////////////////////////
198 196
199 static SkBenchmark* Fact0(void* p) { return new ChartBench(p, true); } 197 static SkBenchmark* Fact0(void* p) { return new ChartBench(p, true); }
200 static SkBenchmark* Fact1(void* p) { return new ChartBench(p, false); } 198 static SkBenchmark* Fact1(void* p) { return new ChartBench(p, false); }
201 199
202 static BenchRegistry gReg0(Fact0); 200 static BenchRegistry gReg0(Fact0);
203 static BenchRegistry gReg1(Fact1); 201 static BenchRegistry gReg1(Fact1);
OLDNEW
« no previous file with comments | « bench/BlurRectBench.cpp ('k') | bench/ChecksumBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698