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

Side by Side Diff: bench/benchmain.cpp

Issue 24440002: Bench baseline for mostly 0 image. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Respond to comments and prevent crash. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | gyp/bench.gypi » ('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 2011 Google Inc. 3 * Copyright 2011 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 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 "record: draw to an SkPicture;\n" 274 "record: draw to an SkPicture;\n"
275 "picturerecord: draw from an SkPicture to an SkPicture.\n"); 275 "picturerecord: draw from an SkPicture to an SkPicture.\n");
276 DEFINE_string(config, "", "Run configs given. If empty, runs the defaults set i n gConfigs."); 276 DEFINE_string(config, "", "Run configs given. If empty, runs the defaults set i n gConfigs.");
277 DEFINE_string(logFile, "", "Also write stdout here."); 277 DEFINE_string(logFile, "", "Also write stdout here.");
278 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run."); 278 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run.");
279 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run."); 279 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run.");
280 DEFINE_double(error, 0.01, 280 DEFINE_double(error, 0.01,
281 "Ratio of subsequent bench measurements must drop within 1±error t o converge."); 281 "Ratio of subsequent bench measurements must drop within 1±error t o converge.");
282 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops."); 282 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops.");
283 DEFINE_bool2(verbose, v, false, "Print more."); 283 DEFINE_bool2(verbose, v, false, "Print more.");
284 DEFINE_string2(resourcePath, i, NULL, "directory for test resources.");
284 285
285 // Has this bench converged? First arguments are milliseconds / loop iteration, 286 // Has this bench converged? First arguments are milliseconds / loop iteration,
286 // last is overall runtime in milliseconds. 287 // last is overall runtime in milliseconds.
287 static bool HasConverged(double prevPerLoop, double currPerLoop, double currRaw) { 288 static bool HasConverged(double prevPerLoop, double currPerLoop, double currRaw) {
288 if (currRaw < FLAGS_minMs) { 289 if (currRaw < FLAGS_minMs) {
289 return false; 290 return false;
290 } 291 }
291 const double low = 1 - FLAGS_error, high = 1 + FLAGS_error; 292 const double low = 1 - FLAGS_error, high = 1 + FLAGS_error;
292 const double ratio = currPerLoop / prevPerLoop; 293 const double ratio = currPerLoop / prevPerLoop;
293 return low < ratio && ratio < high; 294 return low < ratio && ratio < high;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 if (kNormal_BenchMode != benchMode) { 345 if (kNormal_BenchMode != benchMode) {
345 // Non-rendering configs only run in normal mode 346 // Non-rendering configs only run in normal mode
346 for (int i = 0; i < configs.count(); ++i) { 347 for (int i = 0; i < configs.count(); ++i) {
347 const Config& config = gConfigs[configs[i]]; 348 const Config& config = gConfigs[configs[i]];
348 if (kNonRendering_Backend == config.backend) { 349 if (kNonRendering_Backend == config.backend) {
349 configs.remove(i, 1); 350 configs.remove(i, 1);
350 --i; 351 --i;
351 } 352 }
352 } 353 }
353 } 354 }
355 // Set the resource path.
356 if (!FLAGS_resourcePath.isEmpty()) {
357 SkBenchmark::SetResourcePath(FLAGS_resourcePath[0]);
358 }
359
354 #if SK_SUPPORT_GPU 360 #if SK_SUPPORT_GPU
355 for (int i = 0; i < configs.count(); ++i) { 361 for (int i = 0; i < configs.count(); ++i) {
356 const Config& config = gConfigs[configs[i]]; 362 const Config& config = gConfigs[configs[i]];
357 363
358 if (kGPU_Backend == config.backend) { 364 if (kGPU_Backend == config.backend) {
359 GrContext* context = gContextFactory.get(config.contextType); 365 GrContext* context = gContextFactory.get(config.contextType);
360 if (NULL == context) { 366 if (NULL == context) {
361 logger.logError(SkStringPrintf( 367 logger.logError(SkStringPrintf(
362 "Error creating GrContext for config %s. Config will be skip ped.\n", 368 "Error creating GrContext for config %s. Config will be skip ped.\n",
363 config.name)); 369 config.name));
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 gContextFactory.destroyContexts(); 658 gContextFactory.destroyContexts();
653 #endif 659 #endif
654 return 0; 660 return 0;
655 } 661 }
656 662
657 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 663 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
658 int main(int argc, char * const argv[]) { 664 int main(int argc, char * const argv[]) {
659 return tool_main(argc, (char**) argv); 665 return tool_main(argc, (char**) argv);
660 } 666 }
661 #endif 667 #endif
OLDNEW
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | gyp/bench.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698