mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
Merge pull request #796 from O1L/master
PPU / SPU / RawSPU threads in KernelExplorer.
This commit is contained in:
commit
a99c8e3c7c
3 changed files with 125 additions and 21 deletions
|
@ -93,6 +93,22 @@ public:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ThreadStatusToString()
|
||||||
|
{
|
||||||
|
switch (ThreadStatus())
|
||||||
|
{
|
||||||
|
case CPUThread_Ready: return "Ready";
|
||||||
|
case CPUThread_Running: return "Running";
|
||||||
|
case CPUThread_Paused: return "Paused";
|
||||||
|
case CPUThread_Stopped: return "Stopped";
|
||||||
|
case CPUThread_Sleeping: return "Sleeping";
|
||||||
|
case CPUThread_Break: return "Break";
|
||||||
|
case CPUThread_Step: return "Step";
|
||||||
|
|
||||||
|
default: return "Unknown status";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetTypeString() const { return CPUThreadTypeToString(m_type); }
|
std::string GetTypeString() const { return CPUThreadTypeToString(m_type); }
|
||||||
|
|
||||||
virtual std::string GetThreadName() const
|
virtual std::string GetThreadName() const
|
||||||
|
|
|
@ -709,9 +709,12 @@ int cellHddGameCheck(u32 version, vm::ptr<const char> dirName, u32 errDialog, vm
|
||||||
// TODO ?
|
// TODO ?
|
||||||
|
|
||||||
funcStat(result, get, set);
|
funcStat(result, get, set);
|
||||||
if (result->result != CELL_HDDGAME_CBRESULT_OK &&
|
|
||||||
|
/*
|
||||||
|
if (result->result != CELL_HDDGAME_CBRESULT_OK && // error on compiling in MVS. Needs to use LE byte order?
|
||||||
result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL)
|
result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL)
|
||||||
return CELL_HDDGAME_ERROR_CBRESULT;
|
return CELL_HDDGAME_ERROR_CBRESULT;
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO ?
|
// TODO ?
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include "Emu/IdManager.h"
|
#include "Emu/IdManager.h"
|
||||||
#include "KernelExplorer.h"
|
#include "KernelExplorer.h"
|
||||||
|
#include "Emu/CPU/CPUThreadManager.h"
|
||||||
|
#include "Emu/CPU/CPUThread.h"
|
||||||
|
|
||||||
KernelExplorer::KernelExplorer(wxWindow* parent)
|
KernelExplorer::KernelExplorer(wxWindow* parent)
|
||||||
: wxFrame(parent, wxID_ANY, "Kernel Explorer", wxDefaultPosition, wxSize(700, 450))
|
: wxFrame(parent, wxID_ANY, "Kernel Explorer", wxDefaultPosition, wxSize(700, 450))
|
||||||
|
@ -46,17 +48,17 @@ void KernelExplorer::Update()
|
||||||
m_tree->DeleteAllItems();
|
m_tree->DeleteAllItems();
|
||||||
const auto& root = m_tree->AddRoot("Process, ID = 0x00000001, Total Memory Usage = 0x???????? (???.? MB)");
|
const auto& root = m_tree->AddRoot("Process, ID = 0x00000001, Total Memory Usage = 0x???????? (???.? MB)");
|
||||||
|
|
||||||
// TODO: PPU Threads
|
|
||||||
// TODO: SPU/RawSPU Threads
|
|
||||||
// TODO: FileSystem
|
// TODO: FileSystem
|
||||||
|
|
||||||
// Semaphores
|
// Semaphores
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_SEMAPHORE);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_SEMAPHORE);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Semaphores (%d)", count);
|
sprintf(name, "Semaphores (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_SEMAPHORE);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_SEMAPHORE);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "Semaphore: ID = 0x%08x", id);
|
sprintf(name, "Semaphore: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
|
@ -64,11 +66,13 @@ void KernelExplorer::Update()
|
||||||
|
|
||||||
// Mutexes
|
// Mutexes
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_MUTEX);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_MUTEX);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Mutexes (%d)", count);
|
sprintf(name, "Mutexes (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MUTEX);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MUTEX);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "Mutex: ID = 0x%08x", id);
|
sprintf(name, "Mutex: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
|
@ -76,11 +80,13 @@ void KernelExplorer::Update()
|
||||||
|
|
||||||
// Light Weight Mutexes
|
// Light Weight Mutexes
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_LWMUTEX);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_LWMUTEX);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Light Weight Mutexes (%d)", count);
|
sprintf(name, "Light Weight Mutexes (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWMUTEX);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWMUTEX);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "LW Mutex: ID = 0x%08x", id);
|
sprintf(name, "LW Mutex: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
|
@ -88,11 +94,13 @@ void KernelExplorer::Update()
|
||||||
|
|
||||||
// Condition Variables
|
// Condition Variables
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_COND);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_COND);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Condition Variables (%d)", count);
|
sprintf(name, "Condition Variables (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_COND);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_COND);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "Condition Variable: ID = 0x%08x", id);
|
sprintf(name, "Condition Variable: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
|
@ -100,11 +108,13 @@ void KernelExplorer::Update()
|
||||||
|
|
||||||
// Light Weight Condition Variables
|
// Light Weight Condition Variables
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_LWCOND);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_LWCOND);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Light Weight Condition Variables (%d)", count);
|
sprintf(name, "Light Weight Condition Variables (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "LW Condition Variable: ID = 0x%08x", id);
|
sprintf(name, "LW Condition Variable: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
|
@ -112,11 +122,13 @@ void KernelExplorer::Update()
|
||||||
|
|
||||||
// Event Queues
|
// Event Queues
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_QUEUE);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_QUEUE);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Event Queues (%d)", count);
|
sprintf(name, "Event Queues (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_QUEUE);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_QUEUE);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "Event Queue: ID = 0x%08x", id);
|
sprintf(name, "Event Queue: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
|
@ -124,13 +136,15 @@ void KernelExplorer::Update()
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_PRX);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_PRX);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Modules (%d)", count);
|
sprintf(name, "Modules (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_PRX);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_PRX);
|
||||||
sprintf(name, "Segment List (%d)", 2 * objects.size()); // TODO: Assuming 2 segments per PRX file is not good
|
sprintf(name, "Segment List (%d)", 2 * objects.size()); // TODO: Assuming 2 segments per PRX file is not good
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "PRX: ID = 0x%08x", id);
|
sprintf(name, "PRX: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
|
@ -138,27 +152,98 @@ void KernelExplorer::Update()
|
||||||
|
|
||||||
// Memory Containers
|
// Memory Containers
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_MEM);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_MEM);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Memory Containers (%d)", count);
|
sprintf(name, "Memory Containers (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MEM);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MEM);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "Memory Container: ID = 0x%08x", id);
|
sprintf(name, "Memory Container: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Event Flags
|
// Event Flags
|
||||||
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_FLAG);
|
count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_FLAG);
|
||||||
if (count) {
|
if (count)
|
||||||
|
{
|
||||||
sprintf(name, "Event Flags (%d)", count);
|
sprintf(name, "Event Flags (%d)", count);
|
||||||
const auto& node = m_tree->AppendItem(root, name);
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_FLAG);
|
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_FLAG);
|
||||||
for (const auto& id : objects) {
|
for (const auto& id : objects)
|
||||||
|
{
|
||||||
sprintf(name, "Event Flag: ID = 0x%08x", id);
|
sprintf(name, "Event Flag: ID = 0x%08x", id);
|
||||||
m_tree->AppendItem(node, name);
|
m_tree->AppendItem(node, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PPU / SPU / RawSPU threads
|
||||||
|
{
|
||||||
|
// TODO: add mutexes owners
|
||||||
|
|
||||||
|
const auto& objects = Emu.GetCPU().GetThreads();
|
||||||
|
u32 ppu_threads_count = 0;
|
||||||
|
u32 spu_threads_count = 0;
|
||||||
|
u32 raw_spu_threads_count = 0;
|
||||||
|
for (const auto& thread : objects)
|
||||||
|
{
|
||||||
|
if (thread->GetType() == CPU_THREAD_PPU)
|
||||||
|
ppu_threads_count++;
|
||||||
|
|
||||||
|
if (thread->GetType() == CPU_THREAD_SPU)
|
||||||
|
spu_threads_count++;
|
||||||
|
|
||||||
|
if (thread->GetType() == CPU_THREAD_RAW_SPU)
|
||||||
|
raw_spu_threads_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ppu_threads_count)
|
||||||
|
{
|
||||||
|
sprintf(name, "PPU Threads (%d)", ppu_threads_count);
|
||||||
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
|
|
||||||
|
for (const auto& thread : objects)
|
||||||
|
{
|
||||||
|
if (thread->GetType() == CPU_THREAD_PPU)
|
||||||
|
{
|
||||||
|
sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str());
|
||||||
|
m_tree->AppendItem(node, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spu_threads_count)
|
||||||
|
{
|
||||||
|
sprintf(name, "SPU Threads (%d)", spu_threads_count);
|
||||||
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
|
|
||||||
|
for (const auto& thread : objects)
|
||||||
|
{
|
||||||
|
if (thread->GetType() == CPU_THREAD_SPU)
|
||||||
|
{
|
||||||
|
sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str());
|
||||||
|
m_tree->AppendItem(node, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raw_spu_threads_count)
|
||||||
|
{
|
||||||
|
sprintf(name, "RawSPU Threads (%d)", raw_spu_threads_count);
|
||||||
|
const auto& node = m_tree->AppendItem(root, name);
|
||||||
|
|
||||||
|
for (const auto& thread : objects)
|
||||||
|
{
|
||||||
|
if (thread->GetType() == CPU_THREAD_RAW_SPU)
|
||||||
|
{
|
||||||
|
sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str());
|
||||||
|
m_tree->AppendItem(node, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
m_tree->Expand(root);
|
m_tree->Expand(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue