Branch data Line data Source code
1 : : #include <mutable/util/Timer.hpp> 2 : : 3 : : 4 : : using namespace m; 5 : : 6 : : 7 : : M_LCOV_EXCL_START 8 : : std::ostream & m::operator<<(std::ostream &out, const Timer::Measurement &M) 9 : : { 10 : : out << M.name; 11 : : if (M.is_unused()) { 12 : : out << " (removed)"; 13 : : } else if (M.is_active()) { 14 : : out << " started at " << put_timepoint(M.begin) << ", not finished"; 15 : : } else { 16 : : M_insist(M.is_finished()); 17 : : using namespace std::chrono; 18 : : out << " took " << duration_cast<microseconds>(M.duration()).count() / 1e3 << " ms"; 19 : : } 20 : : return out; 21 : : } 22 : : 23 : : void Timer::Measurement::dump(std::ostream &out) const { out << *this << std::endl; } 24 : : void Timer::Measurement::dump() const { dump(std::cerr); } 25 : : 26 : : void Timer::dump(std::ostream &out) const { out << *this; out.flush(); } 27 : : void Timer::dump() const { dump(std::cerr); } 28 : : M_LCOV_EXCL_STOP