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

Unified Diff: bench/benchmain.cpp

Issue 242103013: Add --runOnce flag to run benchs once in release or to force convergence in debug (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove double space from error print Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698