Skip to content

Commit c669a0b

Browse files
committed
kernel_explorer: Order PPUs by priority
1 parent f992ccd commit c669a0b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

rpcs3/rpcs3qt/kernel_explorer.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,15 +651,29 @@ void kernel_explorer::update()
651651
return fmt::format(" (%.1fs)", wait_time);
652652
};
653653

654+
std::vector<std::pair<s32, std::string>> ppu_threads;
655+
654656
idm::select<named_thread<ppu_thread>>([&](u32 id, ppu_thread& ppu)
655657
{
656658
const auto func = ppu.last_function;
657659
const ppu_thread_status status = lv2_obj::ppu_state(&ppu, false, false).first;
658660

659-
add_leaf(find_node(root, additional_nodes::ppu_threads), QString::fromStdString(fmt::format(u8"PPU 0x%07x: “%s”, PRIO: %d, Joiner: %s, Status: %s, State: %s, %s func: “%s”%s", id, *ppu.ppu_tname.load(), ppu.prio.load().prio, ppu.joiner.load(), status, ppu.state.load()
660-
, ppu.ack_suspend ? "After" : (ppu.current_function ? "In" : "Last"), func ? func : "", get_wait_time_str(ppu.start_time))));
661+
const s32 prio = ppu.prio.load().prio;
662+
std::string prio_text = fmt::format("%4d", prio);
663+
prio_text = fmt::replace_all(prio_text, " ", " ");
664+
665+
ppu_threads.emplace_back(prio, fmt::format(u8"PPU 0x%07x: PRIO: %s, “%s”Joiner: %s, Status: %s, State: %s, %s func: “%s”%s", id, prio_text, *ppu.ppu_tname.load(), ppu.joiner.load(), status, ppu.state.load()
666+
, ppu.ack_suspend ? "After" : (ppu.current_function ? "In" : "Last"), func ? func : "", get_wait_time_str(ppu.start_time)));
661667
}, idm::unlocked);
662668

669+
// Sort by priority
670+
std::stable_sort(ppu_threads.begin(), ppu_threads.end(), FN(x.first < y.first));
671+
672+
for (const auto& [prio, text] : ppu_threads)
673+
{
674+
add_leaf(find_node(root, additional_nodes::ppu_threads), QString::fromStdString(text));
675+
}
676+
663677
lock_idm_lv2.reset();
664678

665679
idm::select<named_thread<spu_thread>>([&](u32 /*id*/, spu_thread& spu)

0 commit comments

Comments
 (0)