MCPcopy Create free account
hub / github.com/ElementsProject/elements / LogMsg

Method LogMsg

src/logging/timer.h:61–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 }
60
61 std::string LogMsg(const std::string& msg)
62 {
63 const auto end_time = GetTime<std::chrono::microseconds>() - m_start_t;
64 if (m_start_t.count() <= 0) {
65 return strprintf("%s: %s", m_prefix, msg);
66 }
67
68 if constexpr (std::is_same<TimeType, std::chrono::microseconds>::value) {
69 return strprintf("%s: %s (%iμs)", m_prefix, msg, end_time.count());
70 } else if constexpr (std::is_same<TimeType, std::chrono::milliseconds>::value) {
71 return strprintf("%s: %s (%.2fms)", m_prefix, msg, end_time.count() * 0.001);
72 } else if constexpr (std::is_same<TimeType, std::chrono::seconds>::value) {
73 return strprintf("%s: %s (%.2fs)", m_prefix, msg, end_time.count() * 0.000001);
74 } else {
75 static_assert(ALWAYS_FALSE<TimeType>, "Error: unexpected time type");
76 }
77 }
78
79private:
80 std::chrono::microseconds m_start_t{};

Callers 2

LogMethod · 0.95
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 1

countMethod · 0.80

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64