aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-07-01 08:13:40 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-07-01 09:31:43 +0000
commitf3827b075cf1a326495a7de30ef6f98a86c91da6 (patch)
tree61247f05ba14fefb5865ae981a843c0849ce23e9 /src
parente700e72e8298acd45840131ab14ddade092be15b (diff)
experimental UI: enforce a minimal progress rate limiting if curses unavailable
If the progress bar cannot be updated in place, every additional writing of the progress bar clutters up the log. Of course, this could be controlled by adding --show_progress_rate_limit or even --noshow_progress options to the invocation; however, it turns out that users expect a bazel to just automatically reduce its output rate. Therefore, specify a minimal value for the progress rate limit of 2 seconds if the progress bar cannot be updated in place. Also, increase the time rate for purely time-based updates to 20s in this case. Moreover, only automatically redraw the progress bar after an INFO/WARNING/... message, if it can be updated in place. -- Change-Id: I7d06aa04acec457ec0a5d20ac32ede4cf80f7170 Reviewed-on: https://bazel-review.googlesource.com/#/c/3944 MOS_MIGRATED_REVID=126387987
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java
index 15923f427e..166f3c52ee 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java
@@ -54,10 +54,12 @@ public class ExperimentalEventHandler implements EventHandler {
private static Logger LOG = Logger.getLogger(ExperimentalEventHandler.class.getName());
/** Latest refresh of the progress bar, if contents other than time changed */
static final long MAXIMAL_UPDATE_DELAY_MILLIS = 200L;
+ /** Minimal rate limiting, if the progress bar cannot be updated in place */
+ static final long NO_CURSES_MINIMAL_PROGRESS_RATE_LIMIT = 2000L;
/** Periodic update interval of a time-dependent progress bar if it can be updated in place */
static final long SHORT_REFRESH_MILLIS = 1000L;
/** Periodic update interval of a time-dependent progress bar if it cannot be updated in place */
- static final long LONG_REFRESH_MILLIS = 5000L;
+ static final long LONG_REFRESH_MILLIS = 20000L;
private static final DateTimeFormatter TIMESTAMP_FORMAT =
DateTimeFormat.forPattern("(HH:mm:ss.SSS) ");
@@ -107,7 +109,14 @@ public class ExperimentalEventHandler implements EventHandler {
: new ExperimentalStateTracker(clock);
this.stateTracker.setSampleSize(options.experimentalUiActionsShown);
this.numLinesProgressBar = 0;
- this.minimalDelayMillis = Math.round(options.showProgressRateLimit * 1000);
+ if (this.cursorControl) {
+ this.minimalDelayMillis = Math.round(options.showProgressRateLimit * 1000);
+ } else {
+ this.minimalDelayMillis =
+ Math.max(
+ Math.round(options.showProgressRateLimit * 1000),
+ NO_CURSES_MINIMAL_PROGRESS_RATE_LIMIT);
+ }
this.minimalUpdateInterval = Math.max(this.minimalDelayMillis, MAXIMAL_UPDATE_DELAY_MILLIS);
this.stdoutBuffer = new byte[] {};
this.stderrBuffer = new byte[] {};
@@ -220,7 +229,7 @@ public class ExperimentalEventHandler implements EventHandler {
if (incompleteLine) {
crlf();
}
- if (showProgress && !buildComplete) {
+ if (showProgress && !buildComplete && cursorControl) {
addProgressBar();
}
terminal.flush();