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

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: show timings in debug with "--runOnce false" 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..949275d588c6d1be73d2b599d9de5c1607843c9a 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.");
@@ -387,9 +388,9 @@ int tool_main(int argc, char** argv) {
#endif
// 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");
+ 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 +660,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 +672,8 @@ int tool_main(int argc, char** argv) {
}
}
- if (kIsDebug) {
- // Let's not mislead ourselves by looking at Debug build bench times!
+ if (FLAGS_runOnce) {
+ // 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