summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2013-03-11 20:47:37 (GMT)
committerEvan Martin <martine@danga.com>2013-03-11 20:47:37 (GMT)
commitecc876eb5152c182fc7f3eb768e98936bff9119c (patch)
treecf468307a6f8ee3ef8c4fa778c89b87888016bcc /src
parenta3bf38cac72303bf6a288c26ccc71b1ba9de2b47 (diff)
parent5c132de2b75642edd2f1ead0da11689fcbc9d819 (diff)
downloadNinja-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.cc7
-rw-r--r--src/build.h1
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) {