mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 05:45:38 +00:00
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)
|
||||
{
|
||||
if (level <= GetLogLevel())
|
||||
if (level <= GetLogLevel()) [[unlikely]]
|
||||
Write(channelName, level, message);
|
||||
}
|
||||
ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level,
|
||||
std::string_view message)
|
||||
{
|
||||
if (level <= GetLogLevel())
|
||||
if (level <= GetLogLevel()) [[unlikely]]
|
||||
Write(channelName, functionName, level, message);
|
||||
}
|
||||
template<typename... T>
|
||||
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...));
|
||||
}
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level,
|
||||
fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
if (level <= GetLogLevel())
|
||||
if (level <= GetLogLevel()) [[unlikely]]
|
||||
WriteFmtArgs(channelName, functionName, level, fmt, fmt::make_format_args(args...));
|
||||
}
|
||||
} // 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>();
|
||||
mc->m_filename = filename;
|
||||
if (!mc->LoadFromFile())
|
||||
if (!mc->LoadFromFile()) [[unlikely]]
|
||||
{
|
||||
INFO_LOG("Memory card at '{}' could not be read, formatting.", mc->m_filename);
|
||||
Host::AddIconOSDMessage(fmt::format("memory_card_{}", filename), ICON_FA_SD_CARD,
|
||||
|
|
Loading…
Reference in a new issue