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

Side by Side Diff: bench/benchmain.cpp

Issue 346453002: Refactor how we handle resources path in Tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix rebase conflict Created 6 years, 6 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/SkipZeroesBench.cpp ('k') | dm/DM.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 2011 Google Inc. 2 * Copyright 2011 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 "BenchTimer.h" 8 #include "BenchTimer.h"
9 #include "CrashHandler.h" 9 #include "CrashHandler.h"
10 #include "ResultsWriter.h" 10 #include "ResultsWriter.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 DEFINE_string(config, kDefaultsConfigStr, 248 DEFINE_string(config, kDefaultsConfigStr,
249 "Run configs given. By default, runs the configs marked \"runByDe fault\" in gConfigs."); 249 "Run configs given. By default, runs the configs marked \"runByDe fault\" in gConfigs.");
250 DEFINE_string(logFile, "", "Also write stdout here."); 250 DEFINE_string(logFile, "", "Also write stdout here.");
251 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run."); 251 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run.");
252 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run."); 252 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run.");
253 DEFINE_bool(runOnce, kIsDebug, "Run each bench exactly once and don't report tim ings."); 253 DEFINE_bool(runOnce, kIsDebug, "Run each bench exactly once and don't report tim ings.");
254 DEFINE_double(error, 0.01, 254 DEFINE_double(error, 0.01,
255 "Ratio of subsequent bench measurements must drop within 1±error t o converge."); 255 "Ratio of subsequent bench measurements must drop within 1±error t o converge.");
256 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops."); 256 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops.");
257 DEFINE_bool2(verbose, v, false, "Print more."); 257 DEFINE_bool2(verbose, v, false, "Print more.");
258 DEFINE_string2(resourcePath, i, "resources", "directory for test resources.");
259 DEFINE_string(outResultsFile, "", "If given, the results will be written to the file in JSON format."); 258 DEFINE_string(outResultsFile, "", "If given, the results will be written to the file in JSON format.");
260 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done."); 259 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done.");
261 260
262 // Has this bench converged? First arguments are milliseconds / loop iteration, 261 // Has this bench converged? First arguments are milliseconds / loop iteration,
263 // last is overall runtime in milliseconds. 262 // last is overall runtime in milliseconds.
264 static bool HasConverged(double prevPerLoop, double currPerLoop, double currRaw) { 263 static bool HasConverged(double prevPerLoop, double currPerLoop, double currRaw) {
265 if (currRaw < FLAGS_minMs) { 264 if (currRaw < FLAGS_minMs) {
266 return false; 265 return false;
267 } 266 }
268 const double low = 1 - FLAGS_error, high = 1 + FLAGS_error; 267 const double low = 1 - FLAGS_error, high = 1 + FLAGS_error;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 if (kNormal_BenchMode != benchMode) { 339 if (kNormal_BenchMode != benchMode) {
341 // Non-rendering configs only run in normal mode 340 // Non-rendering configs only run in normal mode
342 for (int i = 0; i < configs.count(); ++i) { 341 for (int i = 0; i < configs.count(); ++i) {
343 const Config& config = gConfigs[configs[i]]; 342 const Config& config = gConfigs[configs[i]];
344 if (SkBenchmark::kNonRendering_Backend == config.backend) { 343 if (SkBenchmark::kNonRendering_Backend == config.backend) {
345 configs.remove(i, 1); 344 configs.remove(i, 1);
346 --i; 345 --i;
347 } 346 }
348 } 347 }
349 } 348 }
350 // Set the resource path.
351 if (!FLAGS_resourcePath.isEmpty()) {
352 SkBenchmark::SetResourcePath(FLAGS_resourcePath[0]);
353 }
354 349
355 #if SK_SUPPORT_GPU 350 #if SK_SUPPORT_GPU
356 for (int i = 0; i < configs.count(); ++i) { 351 for (int i = 0; i < configs.count(); ++i) {
357 const Config& config = gConfigs[configs[i]]; 352 const Config& config = gConfigs[configs[i]];
358 353
359 if (SkBenchmark::kGPU_Backend == config.backend) { 354 if (SkBenchmark::kGPU_Backend == config.backend) {
360 GrContext* context = gContextFactory.get(config.contextType); 355 GrContext* context = gContextFactory.get(config.contextType);
361 if (NULL == context) { 356 if (NULL == context) {
362 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n", 357 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n",
363 config.name); 358 config.name);
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 gContextFactory.destroyContexts(); 677 gContextFactory.destroyContexts();
683 #endif 678 #endif
684 return 0; 679 return 0;
685 } 680 }
686 681
687 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 682 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
688 int main(int argc, char * const argv[]) { 683 int main(int argc, char * const argv[]) {
689 return tool_main(argc, (char**) argv); 684 return tool_main(argc, (char**) argv);
690 } 685 }
691 #endif 686 #endif
OLDNEW
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698