summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-04-05 17:23:28 (GMT)
committerNico Weber <nicolasweber@gmx.de>2018-04-05 17:23:28 (GMT)
commit52c1d0c8f8545231581c4d51cb0a85f50564c415 (patch)
tree2bacb3d3f6a4062cb4e51ef13a538b8689f1ae27
parentf2bb21376c30cbd91aab3e76acf4ff93f3e73f92 (diff)
downloadNinja-52c1d0c8f8545231581c4d51cb0a85f50564c415.zip
Ninja-52c1d0c8f8545231581c4d51cb0a85f50564c415.tar.gz
Ninja-52c1d0c8f8545231581c4d51cb0a85f50564c415.tar.bz2
Fix confusing smart console output from concurrent builds
Developers tend to blame the last printed line when a build takes too long. Unfortunately, when building concurrently, the last printed line may have actually finished a long time ago. Under the current system, ninja does not update the status line to reflect what jobs are still running. This change makes ninja always print the oldest still running job instead. In other words, the likely build bottlenecks. Patch from David Zarzycki, originally uploaded at #1320.
-rw-r--r--src/build.cc13
-rw-r--r--src/build.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/build.cc b/src/build.cc
index 0eda16b..c24d6a9 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -16,6 +16,7 @@
#include <assert.h>
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <functional>
@@ -130,6 +131,18 @@ void BuildStatus::BuildEdgeFinished(Edge* edge,
if (!edge->use_console())
PrintStatus(edge, kEdgeFinished);
+ if (printer_.is_smart_terminal()) {
+ int oldest_start = INT_MAX;
+ Edge* oldest = NULL;
+ for (i = running_edges_.begin(); i != running_edges_.end(); i++) {
+ if (i->second < oldest_start) {
+ oldest_start = i->second;
+ oldest = i->first;
+ }
+ }
+ if (oldest)
+ PrintStatus(oldest, kEdgeRunning);
+ }
// Print the command that is spewing before printing its output.
if (!success) {
diff --git a/src/build.h b/src/build.h
index 9b90e8a..ac7f951 100644
--- a/src/build.h
+++ b/src/build.h
@@ -222,6 +222,7 @@ struct BuildStatus {
enum EdgeStatus {
kEdgeStarted,
+ kEdgeRunning,
kEdgeFinished,
};