From 0da51d25bc6f0fc496ef040cf8e111557419e671 Mon Sep 17 00:00:00 2001 From: Elad Ashkenazi <18193363+elad335@users.noreply.github.com> Date: Sat, 25 May 2024 15:56:40 +0300 Subject: [PATCH] SPU: Add block prefix to log if available --- rpcs3/Emu/Cell/SPUThread.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index f7404894df..25f5984494 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -167,6 +167,17 @@ void fmt_class_string::format(std::string& out, u64 arg) fmt::append(out, "...chunk-0x%05x", (arg & 0xffff) * 4); } +enum class spu_block_hash_short : u64{}; + +template <> +void fmt_class_string::format(std::string& out, u64 arg) +{ + fmt::append(out, "%s", fmt::base57(be_t{arg})); + + // Print only 7 hash characters out of 11 (which covers roughly 48 bits) + out.resize(out.size() - 4); +} + // Verify AVX availability for TSX transactions static const bool s_tsx_avx = utils::has_avx(); @@ -1776,6 +1787,12 @@ void spu_thread::cpu_task() } const auto type = cpu->get_type(); + + if (g_cfg.core.spu_prof) + { + return fmt::format("%sSPU[0x%07x] Thread (%s) [0x%05x: %s]", type >= spu_type::raw ? type == spu_type::isolated ? "Iso" : "Raw" : "", cpu->lv2_id, *name_cache.get(), cpu->pc, spu_block_hash_short{atomic_storage::load(cpu->block_hash)}); + } + return fmt::format("%sSPU[0x%07x] Thread (%s) [0x%05x]", type >= spu_type::raw ? type == spu_type::isolated ? "Iso" : "Raw" : "", cpu->lv2_id, *name_cache.get(), cpu->pc); };