@@ -97,7 +97,7 @@ void BuildStatus::BuildEdgeStarted(Edge* edge) {
97
97
++started_edges_;
98
98
99
99
if (edge->use_console () || printer_.is_smart_terminal ())
100
- PrintStatus (edge);
100
+ PrintStatus (edge, kEdgeStarted );
101
101
102
102
if (edge->use_console ())
103
103
printer_.SetConsoleLocked (true );
@@ -109,6 +109,12 @@ void BuildStatus::BuildEdgeFinished(Edge* edge,
109
109
int * start_time,
110
110
int * end_time) {
111
111
int64_t now = GetTimeMillis ();
112
+
113
+ if (finished_edges_ == 0 ) {
114
+ overall_rate_.Restart ();
115
+ current_rate_.Restart ();
116
+ }
117
+
112
118
++finished_edges_;
113
119
114
120
RunningEdgeMap::iterator i = running_edges_.find (edge);
@@ -123,7 +129,7 @@ void BuildStatus::BuildEdgeFinished(Edge* edge,
123
129
return ;
124
130
125
131
if (!edge->use_console ())
126
- PrintStatus (edge);
132
+ PrintStatus (edge, kEdgeFinished );
127
133
128
134
// Print the command that is spewing before printing its output.
129
135
if (!success) {
@@ -164,7 +170,7 @@ void BuildStatus::BuildFinished() {
164
170
}
165
171
166
172
string BuildStatus::FormatProgressStatus (
167
- const char * progress_status_format) const {
173
+ const char * progress_status_format, EdgeStatus status ) const {
168
174
string out;
169
175
char buf[32 ];
170
176
int percent;
@@ -189,10 +195,15 @@ string BuildStatus::FormatProgressStatus(
189
195
break ;
190
196
191
197
// Running edges.
192
- case ' r' :
193
- snprintf (buf, sizeof (buf), " %d" , started_edges_ - finished_edges_);
198
+ case ' r' : {
199
+ int running_edges = started_edges_ - finished_edges_;
200
+ // count the edge that just finished as a running edge
201
+ if (status == kEdgeFinished )
202
+ running_edges++;
203
+ snprintf (buf, sizeof (buf), " %d" , running_edges);
194
204
out += buf;
195
205
break ;
206
+ }
196
207
197
208
// Unstarted edges.
198
209
case ' u' :
@@ -246,7 +257,7 @@ string BuildStatus::FormatProgressStatus(
246
257
return out;
247
258
}
248
259
249
- void BuildStatus::PrintStatus (Edge* edge) {
260
+ void BuildStatus::PrintStatus (Edge* edge, EdgeStatus status ) {
250
261
if (config_.verbosity == BuildConfig::QUIET)
251
262
return ;
252
263
@@ -256,11 +267,7 @@ void BuildStatus::PrintStatus(Edge* edge) {
256
267
if (to_print.empty () || force_full_command)
257
268
to_print = edge->GetBinding (" command" );
258
269
259
- if (finished_edges_ == 0 ) {
260
- overall_rate_.Restart ();
261
- current_rate_.Restart ();
262
- }
263
- to_print = FormatProgressStatus (progress_status_format_) + to_print;
270
+ to_print = FormatProgressStatus (progress_status_format_, status) + to_print;
264
271
265
272
printer_.Print (to_print,
266
273
force_full_command ? LinePrinter::FULL : LinePrinter::ELIDE);
0 commit comments