summaryrefslogtreecommitdiff
path: root/src/timing_logger.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/timing_logger.h')
-rw-r--r--src/timing_logger.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/timing_logger.h b/src/timing_logger.h
index 594ae98b55..d713edf07b 100644
--- a/src/timing_logger.h
+++ b/src/timing_logger.h
@@ -38,15 +38,19 @@ class TimingLogger {
labels_.push_back(label);
}
- void Dump() {
- LOG(INFO) << name_ << ": begin";
+ void Dump() const {
+ Dump(LOG(INFO));
+ }
+
+ void Dump(std::ostream& os) const {
+ os << name_ << ": begin";
for (size_t i = 1; i < times_.size(); ++i) {
- LOG(INFO) << name_ << StringPrintf(": %8lld ms, ", NsToMs(times_[i] - times_[i-1])) << labels_[i];
+ os << name_ << StringPrintf(": %8lld ms, ", NsToMs(times_[i] - times_[i-1])) << labels_[i];
}
- LOG(INFO) << name_ << ": end, " << NsToMs(GetTotalNs()) << " ms";
+ os << name_ << ": end, " << NsToMs(GetTotalNs()) << " ms";
}
- uint64_t GetTotalNs() {
+ uint64_t GetTotalNs() const {
return times_.back() - times_.front();
}