mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-10-11 22:49:55 +00:00
RawSpu: only work mmio stats when spu_log is trace
This commit is contained in:
@@ -40,32 +40,6 @@ bool spu_thread::read_reg(const u32 addr, u32& value)
|
||||
{
|
||||
const u32 offset = addr - (RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index) - RAW_SPU_PROB_OFFSET;
|
||||
|
||||
const auto [old_stats, is_changed] = mmio_stats.fetch_op([&](raw_spu_log_stats_t& old)
|
||||
{
|
||||
if (old.mmio_offset == offset)
|
||||
{
|
||||
const u64 current = get_system_time();
|
||||
|
||||
if (current - old.mmio_time >= 1500)
|
||||
{
|
||||
old.mmio_time = current;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
old.mmio_offset = offset;
|
||||
return true;
|
||||
});
|
||||
|
||||
std::string log_message = fmt::format("RawSPU[%u]: read_reg(0x%x, offset=0x%x)", index, addr, offset);
|
||||
|
||||
if (is_changed)
|
||||
{
|
||||
spu_log.trace("%s", log_message);
|
||||
}
|
||||
|
||||
struct logger_end_t
|
||||
{
|
||||
u32 offset;
|
||||
@@ -75,6 +49,8 @@ bool spu_thread::read_reg(const u32 addr, u32& value)
|
||||
|
||||
~logger_end_t() noexcept
|
||||
{
|
||||
if (log_message.empty()) return;
|
||||
|
||||
const auto [old, value_changed] = stats->fetch_op([&](raw_spu_log_stats_t& old)
|
||||
{
|
||||
if (old.mmio_offset == offset)
|
||||
@@ -96,7 +72,38 @@ bool spu_thread::read_reg(const u32 addr, u32& value)
|
||||
spu_log.trace("%s: value=0x%x", log_message, *value);
|
||||
}
|
||||
}
|
||||
} logger_end{offset, &value, &mmio_stats, std::move(log_message)};
|
||||
} logger_end{offset, &value, &mmio_stats, {}};
|
||||
|
||||
if (spu_log.trace)
|
||||
{
|
||||
const auto [old_stats, is_changed] = mmio_stats.fetch_op([&](raw_spu_log_stats_t& old)
|
||||
{
|
||||
if (old.mmio_offset == offset)
|
||||
{
|
||||
const u64 current = get_system_time();
|
||||
|
||||
if (current - old.mmio_time >= 1500)
|
||||
{
|
||||
old.mmio_time = current;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
old.mmio_offset = offset;
|
||||
return true;
|
||||
});
|
||||
|
||||
std::string log_message = fmt::format("RawSPU[%u]: read_reg(0x%x, offset=0x%x)", index, addr, offset);
|
||||
|
||||
if (is_changed)
|
||||
{
|
||||
spu_log.trace("%s", log_message);
|
||||
}
|
||||
|
||||
logger_end.log_message = std::move(log_message);
|
||||
}
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
@@ -267,29 +274,32 @@ bool spu_thread::write_reg(const u32 addr, const u32 value)
|
||||
{
|
||||
const u32 offset = addr - (RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index) - RAW_SPU_PROB_OFFSET;
|
||||
|
||||
const auto [old_stats, is_changed] = mmio_stats.fetch_op([&](raw_spu_log_stats_t& old)
|
||||
if (spu_log.trace)
|
||||
{
|
||||
if (old.mmio_offset == offset && old.mmio_value == value)
|
||||
const auto [old_stats, is_changed] = mmio_stats.fetch_op([&](raw_spu_log_stats_t& old)
|
||||
{
|
||||
const u64 current = get_system_time();
|
||||
|
||||
if (current - old.mmio_time >= 500)
|
||||
if (old.mmio_offset == offset && old.mmio_value == value)
|
||||
{
|
||||
old.mmio_time = current;
|
||||
return true;
|
||||
const u64 current = get_system_time();
|
||||
|
||||
if (current - old.mmio_time >= 500)
|
||||
{
|
||||
old.mmio_time = current;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
old.mmio_offset = offset;
|
||||
old.mmio_value = value;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (is_changed)
|
||||
{
|
||||
spu_log.trace("RawSPU[%u]: write_reg(0x%x, offset=0x%x, value=0x%x)", index, addr, offset, value);
|
||||
}
|
||||
|
||||
old.mmio_offset = offset;
|
||||
old.mmio_value = value;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (is_changed)
|
||||
{
|
||||
spu_log.trace("RawSPU[%u]: write_reg(0x%x, offset=0x%x, value=0x%x)", index, addr, offset, value);
|
||||
}
|
||||
|
||||
switch (offset)
|
||||
|
||||
Reference in New Issue
Block a user