Common/Log: Make actually writing unlikely
Move it out of the hot path.
This commit is contained in:
parent
89eea91ed5
commit
890f3fcf5d
|
@ -72,26 +72,26 @@ void WriteFmtArgs(const char* channelName, const char* functionName, LOGLEVEL le
|
||||||
|
|
||||||
ALWAYS_INLINE static void FastWrite(const char* channelName, LOGLEVEL level, std::string_view message)
|
ALWAYS_INLINE static void FastWrite(const char* channelName, LOGLEVEL level, std::string_view message)
|
||||||
{
|
{
|
||||||
if (level <= GetLogLevel())
|
if (level <= GetLogLevel()) [[unlikely]]
|
||||||
Write(channelName, level, message);
|
Write(channelName, level, message);
|
||||||
}
|
}
|
||||||
ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level,
|
ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level,
|
||||||
std::string_view message)
|
std::string_view message)
|
||||||
{
|
{
|
||||||
if (level <= GetLogLevel())
|
if (level <= GetLogLevel()) [[unlikely]]
|
||||||
Write(channelName, functionName, level, message);
|
Write(channelName, functionName, level, message);
|
||||||
}
|
}
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
ALWAYS_INLINE static void FastWrite(const char* channelName, LOGLEVEL level, fmt::format_string<T...> fmt, T&&... args)
|
ALWAYS_INLINE static void FastWrite(const char* channelName, LOGLEVEL level, fmt::format_string<T...> fmt, T&&... args)
|
||||||
{
|
{
|
||||||
if (level <= GetLogLevel())
|
if (level <= GetLogLevel()) [[unlikely]]
|
||||||
WriteFmtArgs(channelName, level, fmt, fmt::make_format_args(args...));
|
WriteFmtArgs(channelName, level, fmt, fmt::make_format_args(args...));
|
||||||
}
|
}
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level,
|
ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level,
|
||||||
fmt::format_string<T...> fmt, T&&... args)
|
fmt::format_string<T...> fmt, T&&... args)
|
||||||
{
|
{
|
||||||
if (level <= GetLogLevel())
|
if (level <= GetLogLevel()) [[unlikely]]
|
||||||
WriteFmtArgs(channelName, functionName, level, fmt, fmt::make_format_args(args...));
|
WriteFmtArgs(channelName, functionName, level, fmt, fmt::make_format_args(args...));
|
||||||
}
|
}
|
||||||
} // namespace Log
|
} // namespace Log
|
||||||
|
|
|
@ -299,7 +299,7 @@ std::unique_ptr<MemoryCard> MemoryCard::Open(std::string_view filename)
|
||||||
{
|
{
|
||||||
std::unique_ptr<MemoryCard> mc = std::make_unique<MemoryCard>();
|
std::unique_ptr<MemoryCard> mc = std::make_unique<MemoryCard>();
|
||||||
mc->m_filename = filename;
|
mc->m_filename = filename;
|
||||||
if (!mc->LoadFromFile())
|
if (!mc->LoadFromFile()) [[unlikely]]
|
||||||
{
|
{
|
||||||
INFO_LOG("Memory card at '{}' could not be read, formatting.", mc->m_filename);
|
INFO_LOG("Memory card at '{}' could not be read, formatting.", mc->m_filename);
|
||||||
Host::AddIconOSDMessage(fmt::format("memory_card_{}", filename), ICON_FA_SD_CARD,
|
Host::AddIconOSDMessage(fmt::format("memory_card_{}", filename), ICON_FA_SD_CARD,
|
||||||
|
|
Loading…
Reference in New Issue