summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/manual.asciidoc3
-rw-r--r--src/build.cc7
-rw-r--r--src/build.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc
index c23a3e3..83340cb 100644
--- a/doc/manual.asciidoc
+++ b/doc/manual.asciidoc
@@ -222,6 +222,7 @@ Several placeholders are available:
`%f`:: The number of finished edges.
`%o`:: Overall rate of finished edges per second
`%c`:: Current rate of finished edges per second (average over builds specified by -j or its default)
+`%e`:: Elapsed time in seconds. _(Available since Ninja 1.2.)_
`%%`:: A plain `%` character.
The default progress status is `"[%s/%t] "` (note the trailing space
@@ -690,7 +691,7 @@ keys.
$variables are expanded) is passed directly to `sh -c` without
interpretation by Ninja. Each `rule` may have only one `command`
declaration. To specify multiple commands use `&&` (or similar) to
- concatenate operations.
+ concatenate operations.
`depfile`:: path to an optional `Makefile` that contains extra
_implicit dependencies_ (see <<ref_dependencies,the reference on
diff --git a/src/build.cc b/src/build.cc
index 701fa92..1e3ad9e 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -238,6 +238,13 @@ string BuildStatus::FormatProgressStatus(
out += buf;
break;
+ case 'e': {
+ double elapsed = overall_rate_.Elapsed();
+ snprintf(buf, sizeof(buf), "%.3f", elapsed);
+ out += buf;
+ break;
+ }
+
default:
Fatal("unknown placeholder '%%%c' in $NINJA_STATUS", *s);
return "";
diff --git a/src/build.h b/src/build.h
index 23f653e..5747170 100644
--- a/src/build.h
+++ b/src/build.h
@@ -220,6 +220,7 @@ struct BuildStatus {
RateInfo() : rate_(-1) {}
void Restart() { stopwatch_.Restart(); }
+ double Elapsed() const { return stopwatch_.Elapsed(); }
double rate() { return rate_; }
void UpdateRate(int edges) {