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

Side by Side Diff: bench/nanobench.cpp

Issue 1379853003: Fix for nexus 5 crashing in GL benches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 2 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
« no previous file with comments | « bench/TextBlobBench.cpp ('k') | tools/VisualBench/VisualInteractiveModule.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 2014 Google Inc. 2 * Copyright 2014 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 <ctype.h> 8 #include <ctype.h>
9 9
10 #include "nanobench.h" 10 #include "nanobench.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 200 }
201 }; 201 };
202 202
203 #endif 203 #endif
204 204
205 static double time(int loops, Benchmark* bench, Target* target) { 205 static double time(int loops, Benchmark* bench, Target* target) {
206 SkCanvas* canvas = target->getCanvas(); 206 SkCanvas* canvas = target->getCanvas();
207 if (canvas) { 207 if (canvas) {
208 canvas->clear(SK_ColorWHITE); 208 canvas->clear(SK_ColorWHITE);
209 } 209 }
210 bench->preDraw(canvas);
210 WallTimer timer; 211 WallTimer timer;
211 timer.start(); 212 timer.start();
212 canvas = target->beginTiming(canvas); 213 canvas = target->beginTiming(canvas);
213 bench->draw(loops, canvas); 214 bench->draw(loops, canvas);
214 if (canvas) { 215 if (canvas) {
215 canvas->flush(); 216 canvas->flush();
216 } 217 }
217 target->endTiming(); 218 target->endTiming();
218 timer.end(); 219 timer.end();
220 bench->postDraw(canvas);
219 return timer.fWall; 221 return timer.fWall;
220 } 222 }
221 223
222 static double estimate_timer_overhead() { 224 static double estimate_timer_overhead() {
223 double overhead = 0; 225 double overhead = 0;
224 for (int i = 0; i < FLAGS_overheadLoops; i++) { 226 for (int i = 0; i < FLAGS_overheadLoops; i++) {
225 WallTimer timer; 227 WallTimer timer;
226 timer.start(); 228 timer.start();
227 timer.end(); 229 timer.end();
228 overhead += timer.fWall; 230 overhead += timer.fWall;
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 int runs = 0; 1159 int runs = 0;
1158 BenchmarkStream benchStream; 1160 BenchmarkStream benchStream;
1159 while (Benchmark* b = benchStream.next()) { 1161 while (Benchmark* b = benchStream.next()) {
1160 SkAutoTDelete<Benchmark> bench(b); 1162 SkAutoTDelete<Benchmark> bench(b);
1161 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName())) { 1163 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName())) {
1162 continue; 1164 continue;
1163 } 1165 }
1164 1166
1165 if (!configs.isEmpty()) { 1167 if (!configs.isEmpty()) {
1166 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi ze().fY); 1168 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi ze().fY);
1167 bench->preDraw(); 1169 bench->delayedSetup();
1168 } 1170 }
1169 for (int i = 0; i < configs.count(); ++i) { 1171 for (int i = 0; i < configs.count(); ++i) {
1170 Target* target = is_enabled(b, configs[i]); 1172 Target* target = is_enabled(b, configs[i]);
1171 if (!target) { 1173 if (!target) {
1172 continue; 1174 continue;
1173 } 1175 }
1174 1176
1175 // During HWUI output this canvas may be nullptr. 1177 // During HWUI output this canvas may be nullptr.
1176 SkCanvas* canvas = target->getCanvas(); 1178 SkCanvas* canvas = target->getCanvas();
1177 const char* config = target->config.name; 1179 const char* config = target->config.name;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 1292
1291 return 0; 1293 return 0;
1292 } 1294 }
1293 1295
1294 #if !defined SK_BUILD_FOR_IOS 1296 #if !defined SK_BUILD_FOR_IOS
1295 int main(int argc, char** argv) { 1297 int main(int argc, char** argv) {
1296 SkCommandLineFlags::Parse(argc, argv); 1298 SkCommandLineFlags::Parse(argc, argv);
1297 return nanobench_main(); 1299 return nanobench_main();
1298 } 1300 }
1299 #endif 1301 #endif
OLDNEW
« no previous file with comments | « bench/TextBlobBench.cpp ('k') | tools/VisualBench/VisualInteractiveModule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698