You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
930 B
C++
34 lines
930 B
C++
#pragma once
|
|
|
|
// third party library
|
|
#include "fmt/format.h"
|
|
|
|
#include "spdlog/pattern_formatter.h"
|
|
#include "spdlog/stopwatch.h"
|
|
|
|
// mitech library
|
|
// #include "utility.h"
|
|
|
|
class CTimingFormatterFlag : public spdlog::custom_flag_formatter
|
|
{
|
|
public:
|
|
void format(const spdlog::details::log_msg&, const std::tm&, spdlog::memory_buf_t& dest) override
|
|
{
|
|
|
|
// auto myTime = m_HighResCounter.GetCurrentTimeSpanInMsec();
|
|
|
|
// std::string strTime2 = fmt::format("{} | {:d}.{:03d}", strTime, (myTime / 1000), (myTime % 1000));
|
|
|
|
std::string strTime = fmt::format("{:.3f}", m_stopWatch);
|
|
dest.append(strTime.data(), strTime.data() + strTime.size());
|
|
}
|
|
|
|
std::unique_ptr<custom_flag_formatter> clone() const override
|
|
{
|
|
return spdlog::details::make_unique<CTimingFormatterFlag>();
|
|
}
|
|
|
|
private:
|
|
spdlog::stopwatch m_stopWatch;
|
|
// CHighResPerformanceCounter m_HighResCounter;
|
|
}; |