7 #include <unordered_map>
9 #include "fmt/chrono.h"
10 #include "spdlog/spdlog.h"
12 using t_clock = std::chrono::high_resolution_clock;
22 std::chrono::duration<double, std::milli>
time;
29 void Print(std::shared_ptr<spdlog::logger> logger) {
31 logger->debug(
"Timers results:");
32 for (
const auto &measurement :
m_timers) {
33 logger->debug(
"{0: >30}: {1}", measurement.first, measurement.second.time);
34 if (measurement.second.nCalls > 0) {
35 logger->debug(
"{0: >30} {1} per call",
"", measurement.second.time / measurement.second.nCalls);
41 void UpdateTimer(std::string timerName, t_clock::duration time) {
44 auto &measurement =
m_timers[timerName];
45 measurement.time += time;