diff options
author | Evan Martin <martine@danga.com> | 2013-03-11 20:47:37 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2013-03-11 20:47:37 (GMT) |
commit | ecc876eb5152c182fc7f3eb768e98936bff9119c (patch) | |
tree | cf468307a6f8ee3ef8c4fa778c89b87888016bcc /src | |
parent | a3bf38cac72303bf6a288c26ccc71b1ba9de2b47 (diff) | |
parent | 5c132de2b75642edd2f1ead0da11689fcbc9d819 (diff) | |
download | Ninja-ecc876eb5152c182fc7f3eb768e98936bff9119c.zip Ninja-ecc876eb5152c182fc7f3eb768e98936bff9119c.tar.gz Ninja-ecc876eb5152c182fc7f3eb768e98936bff9119c.tar.bz2 |
Merge pull request #513 from fifoforlifo/master
Adding elapsed time (%e) to NINJA_STATUS.
Diffstat (limited to 'src')
-rw-r--r-- | src/build.cc | 7 | ||||
-rw-r--r-- | src/build.h | 1 |
2 files changed, 8 insertions, 0 deletions
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) { |