Tidy up and finish reference table dumping.
Change-Id: I9f0d214e27a75d373e3144b738f1e3da51bbc0ca
diff --git a/src/timing_logger.h b/src/timing_logger.h
index 594ae98..d713edf 100644
--- a/src/timing_logger.h
+++ b/src/timing_logger.h
@@ -38,15 +38,19 @@
labels_.push_back(label);
}
- void Dump() {
- LOG(INFO) << 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];
- }
- LOG(INFO) << name_ << ": end, " << NsToMs(GetTotalNs()) << " ms";
+ void Dump() const {
+ Dump(LOG(INFO));
}
- uint64_t GetTotalNs() {
+ void Dump(std::ostream& os) const {
+ os << name_ << ": begin";
+ for (size_t i = 1; i < times_.size(); ++i) {
+ os << name_ << StringPrintf(": %8lld ms, ", NsToMs(times_[i] - times_[i-1])) << labels_[i];
+ }
+ os << name_ << ": end, " << NsToMs(GetTotalNs()) << " ms";
+ }
+
+ uint64_t GetTotalNs() const {
return times_.back() - times_.front();
}