Chromium Code Reviews| Index: bench/benchmain.cpp |
| diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp |
| index 9cdaa68ebc27854323e1b39b4a6e192c57e1534f..f676665ee7e9bf364be5d7579b5abe6e3c51e9af 100644 |
| --- a/bench/benchmain.cpp |
| +++ b/bench/benchmain.cpp |
| @@ -261,6 +261,7 @@ DEFINE_string(config, kDefaultsConfigStr, |
| DEFINE_string(logFile, "", "Also write stdout here."); |
| DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run."); |
| DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run."); |
| +DEFINE_bool(runOnce, kIsDebug, "Run each bench exactly once and don't report timings."); |
| DEFINE_double(error, 0.01, |
| "Ratio of subsequent bench measurements must drop within 1±error to converge."); |
| DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops."); |
| @@ -389,7 +390,10 @@ int tool_main(int argc, char** argv) { |
| // All flags should be parsed now. Report our settings. |
| if (kIsDebug) { |
| logger.logError("bench was built in Debug mode, so we're going to hide the times." |
| - " It's for your own good!\n"); |
| + " It's for your own good!\n"); |
| + } else if (FLAGS_runOnce) { |
| + logger.logError("bench was run with --runOnce, so we're going to hide the times." |
| + " It's for your own good!\n"); |
| } |
| writer.option("mode", FLAGS_mode[0]); |
| writer.option("alpha", SkStringPrintf("0x%02X", alpha).c_str()); |
| @@ -659,7 +663,7 @@ int tool_main(int argc, char** argv) { |
| if (FLAGS_verbose) { SkDebugf("%.3g ", current); } |
| converged = HasConverged(previous, current, timer.fWall); |
| previous = current; |
| - } while (!kIsDebug && !converged); |
| + } while (!FLAGS_runOnce && !converged); |
| } |
| if (FLAGS_verbose) { SkDebugf("\n"); } |
| @@ -671,8 +675,8 @@ int tool_main(int argc, char** argv) { |
| } |
| } |
| - if (kIsDebug) { |
| - // Let's not mislead ourselves by looking at Debug build bench times! |
| + if (kIsDebug || FLAGS_runOnce) { |
|
mtklein
2014/04/21 20:04:16
Let's just fold it into one bool? It's really the
bsalomon
2014/04/21 20:42:50
Done.
|
| + // Let's not mislead ourselves by looking at Debug build or single iteration bench times! |
| continue; |
| } |