15 #ifndef NINJA_METRICS_H_
16 #define NINJA_METRICS_H_
83 #define METRIC_RECORD(name) \
84 static Metric* metrics_h_metric = \
85 g_metrics ? g_metrics->NewMetric(name) : NULL; \
86 ScopedMetric metrics_h_scoped(metrics_h_metric);
90 #define METRIC_RECORD_IF(name, condition) \
91 static Metric* metrics_h_metric = \
92 g_metrics ? g_metrics->NewMetric(name) : NULL; \
93 ScopedMetric metrics_h_scoped((condition) ? metrics_h_metric : NULL);
int64_t GetTimeMillis()
Get the current time as relative to some epoch.
The Metrics module is used for the debug mode that dumps timing stats of various actions.
int count
Number of times we've hit the code path.
int64_t sum
Total time (in platform-dependent units) we've spent on the code path.
The singleton that stores metrics and prints the report.
std::vector< Metric * > metrics_
void Report()
Print a summary report to stdout.
Metric * NewMetric(const std::string &name)
A scoped object for recording a metric across the body of a function.
int64_t start_
Timestamp when the measurement started.
ScopedMetric(Metric *metric)
A simple stopwatch which returns the time in seconds since Restart() was called.
double Elapsed() const
Seconds since Restart() call.
unsigned long long uint64_t
signed long long int64_t
A 64-bit integer type.