summaryrefslogtreecommitdiffstats
path: root/src/metrics.h
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2012-09-14 13:37:31 (GMT)
committerNico Weber <nicolasweber@gmx.de>2012-09-14 13:48:48 (GMT)
commit48143c9b07eca30c99d47cadf3c0ae111b369f1b (patch)
tree664f292f0ca0797ecb02a5c7df0f5158eb36f51d /src/metrics.h
parent06fa62352d1e9868409b299ffc8abc8f4cd9a39d (diff)
downloadNinja-48143c9b07eca30c99d47cadf3c0ae111b369f1b.zip
Ninja-48143c9b07eca30c99d47cadf3c0ae111b369f1b.tar.gz
Ninja-48143c9b07eca30c99d47cadf3c0ae111b369f1b.tar.bz2
Change rate measurement code.
For %o, remove a superfluous + 0.5: snprintf("%f") rounds already. Remove some unnecessary code. For %c, fix a TODO to add a sliding window and update after every completed edge. Else, with -j50 and several files that take 3s to compile each, this number would only update every 150s. Also give the number one decimal place so that this can measure steps slower than 1s.
Diffstat (limited to 'src/metrics.h')
-rw-r--r--src/metrics.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/metrics.h b/src/metrics.h
index f5ac0de..a4ef9f7 100644
--- a/src/metrics.h
+++ b/src/metrics.h
@@ -59,19 +59,18 @@ private:
};
/// Get the current time as relative to some epoch.
-/// Epoch varies between platforms; only useful for measuring elapsed
-/// time.
+/// Epoch varies between platforms; only useful for measuring elapsed time.
int64_t GetTimeMillis();
-/// A simple stopwatch which retruns the time
-// in seconds since Restart() was called
+/// A simple stopwatch which returns the time
+/// in seconds since Restart() was called.
class Stopwatch
{
public:
Stopwatch() : started_(0) {}
- /// Seconds since Restart() call
+ /// Seconds since Restart() call.
double Elapsed() const { return 1e-6 * static_cast<double>(Now() - started_); }
void Restart() { started_ = Now(); }