mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-27 06:21:02 +00:00
logs: use relaxed atomics
May help with optimizations.
This commit is contained in:
parent
3eca2d5d6c
commit
ec80932c21
@ -169,7 +169,7 @@ namespace logs
|
||||
|
||||
for (auto&& pair : get_logger()->channels)
|
||||
{
|
||||
pair.second->enabled = level::notice;
|
||||
pair.second->enabled.store(level::notice, std::memory_order_relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ namespace logs
|
||||
|
||||
for (auto&& pair : get_logger()->channels)
|
||||
{
|
||||
pair.second->enabled = level::always;
|
||||
pair.second->enabled.store(level::always, std::memory_order_relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ namespace logs
|
||||
|
||||
while (found.first != found.second)
|
||||
{
|
||||
found.first->second->enabled = value;
|
||||
found.first->second->enabled.store(value, std::memory_order_relaxed);
|
||||
found.first++;
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ namespace logs
|
||||
|
||||
if (found.first != found.second)
|
||||
{
|
||||
return found.first->second->enabled;
|
||||
return found.first->second->enabled.load(std::memory_order_relaxed);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include "util/atomic.hpp"
|
||||
#include "StrFmt.h"
|
||||
#include <climits>
|
||||
#include "util/atomic.hpp"
|
||||
#include <atomic>
|
||||
|
||||
namespace logs
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace logs
|
||||
const char* const name;
|
||||
|
||||
// The lowest logging level enabled for this channel (used for early filtering)
|
||||
atomic_t<level> enabled;
|
||||
std::atomic<level> enabled;
|
||||
|
||||
// Initialize and register channel
|
||||
channel(const char* name);
|
||||
@ -69,7 +69,7 @@ namespace logs
|
||||
template <std::size_t N, typename... Args>\
|
||||
void _sev(const char(&fmt)[N], const Args&... args)\
|
||||
{\
|
||||
if (UNLIKELY(level::_sev <= enabled))\
|
||||
if (UNLIKELY(level::_sev <= enabled.load(std::memory_order_relaxed)))\
|
||||
{\
|
||||
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};\
|
||||
msg_##_sev.broadcast(fmt, type_list, u64{fmt_unveil<Args>::get(args)}...);\
|
||||
|
Loading…
Reference in New Issue
Block a user