Fixed console commands not registering. Code cleanup.
This commit is contained in:
parent
3e6e997e8b
commit
714633f311
|
@ -17,8 +17,8 @@
|
||||||
#include "PowerPCDisasm.h"
|
#include "PowerPCDisasm.h"
|
||||||
#include "Console.h"
|
#include "Console.h"
|
||||||
|
|
||||||
#define CASE1(x) if (memcmp(cmd, x, 2*sizeof(TCHAR))==0)
|
#define CASE1(x) if (!strcmp(cmd, (x)))
|
||||||
#define CASE(x) else if (memcmp(cmd, x, 4*sizeof(TCHAR))==0)
|
#define CASE(x) else if (!strcmp(cmd, (x)))
|
||||||
|
|
||||||
void Console_Submit(const char *cmd)
|
void Console_Submit(const char *cmd)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ void Console_Submit(const char *cmd)
|
||||||
Core::StartTrace(false);
|
Core::StartTrace(false);
|
||||||
INFO_LOG(CONSOLE, "Read tracing started.");
|
INFO_LOG(CONSOLE, "Read tracing started.");
|
||||||
}
|
}
|
||||||
CASE1("w")
|
CASE("w")
|
||||||
{
|
{
|
||||||
Core::StartTrace(true);
|
Core::StartTrace(true);
|
||||||
INFO_LOG(CONSOLE, "Write tracing started.");
|
INFO_LOG(CONSOLE, "Write tracing started.");
|
||||||
|
@ -141,3 +141,6 @@ void Console_Submit(const char *cmd)
|
||||||
ERROR_LOG(CONSOLE, "Invalid command");
|
ERROR_LOG(CONSOLE, "Invalid command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef CASE1
|
||||||
|
#undef CASE
|
||||||
|
|
|
@ -14,24 +14,15 @@
|
||||||
#include "Interpreter/Interpreter_Tables.h"
|
#include "Interpreter/Interpreter_Tables.h"
|
||||||
#include "JitInterface.h"
|
#include "JitInterface.h"
|
||||||
|
|
||||||
struct op_inf
|
GekkoOPInfo *m_infoTable[64];
|
||||||
{
|
GekkoOPInfo *m_infoTable4[1024];
|
||||||
const char *name;
|
GekkoOPInfo *m_infoTable19[1024];
|
||||||
int count;
|
GekkoOPInfo *m_infoTable31[1024];
|
||||||
bool operator < (const op_inf &o) const
|
GekkoOPInfo *m_infoTable59[32];
|
||||||
{
|
GekkoOPInfo *m_infoTable63[1024];
|
||||||
return count > o.count;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
GekkoOPInfo *m_infoTable[64];
|
|
||||||
GekkoOPInfo *m_infoTable4[1024];
|
|
||||||
GekkoOPInfo *m_infoTable19[1024];
|
|
||||||
GekkoOPInfo *m_infoTable31[1024];
|
|
||||||
GekkoOPInfo *m_infoTable59[32];
|
|
||||||
GekkoOPInfo *m_infoTable63[1024];
|
|
||||||
|
|
||||||
GekkoOPInfo *m_allInstructions[512];
|
GekkoOPInfo *m_allInstructions[512];
|
||||||
int m_numInstructions;
|
int m_numInstructions;
|
||||||
|
|
||||||
GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
|
GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
|
||||||
{
|
{
|
||||||
|
@ -182,26 +173,34 @@ void CountInstruction(UGeckoInstruction _inst)
|
||||||
{
|
{
|
||||||
GekkoOPInfo *info = GetOpInfo(_inst);
|
GekkoOPInfo *info = GetOpInfo(_inst);
|
||||||
if (info)
|
if (info)
|
||||||
|
{
|
||||||
info->runCount++;
|
info->runCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintInstructionRunCounts()
|
void PrintInstructionRunCounts()
|
||||||
{
|
{
|
||||||
std::vector<op_inf> temp;
|
typedef std::pair<const char*, u64> OpInfo;
|
||||||
for (int i = 0; i < m_numInstructions; i++)
|
std::vector<OpInfo> temp;
|
||||||
|
temp.reserve(m_numInstructions);
|
||||||
|
for (int i = 0; i < m_numInstructions; ++i)
|
||||||
{
|
{
|
||||||
op_inf x;
|
GekkoOPInfo *pInst = m_allInstructions[i];
|
||||||
x.name = m_allInstructions[i]->opname;
|
temp.emplace_back(pInst->opname, pInst->runCount);
|
||||||
x.count = (int)(m_allInstructions[i]->runCount);
|
|
||||||
temp.push_back(x);
|
|
||||||
}
|
}
|
||||||
std::sort(temp.begin(), temp.end());
|
std::sort(temp.begin(), temp.end(),
|
||||||
for (int i = 0; i < m_numInstructions; i++)
|
[](const OpInfo &a, const OpInfo &b)
|
||||||
|
{
|
||||||
|
return a.second > b.second;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (auto &inst : temp)
|
||||||
{
|
{
|
||||||
if (temp[i].count == 0)
|
if (inst.second == 0)
|
||||||
break;
|
break;
|
||||||
DEBUG_LOG(POWERPC, "%s : %i", temp[i].name,temp[i].count);
|
|
||||||
//PanicAlert("%s : %i", temp[i].name,temp[i].count);
|
DEBUG_LOG(POWERPC, "%s : %llu", inst.first, inst.second);
|
||||||
|
//PanicAlert("%s : %llu", inst.first, inst.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,20 +211,22 @@ void LogCompiledInstructions()
|
||||||
File::IOFile f(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
|
File::IOFile f(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
|
||||||
for (int i = 0; i < m_numInstructions; i++)
|
for (int i = 0; i < m_numInstructions; i++)
|
||||||
{
|
{
|
||||||
if (m_allInstructions[i]->compileCount > 0)
|
GekkoOPInfo *pInst = m_allInstructions[i];
|
||||||
|
if (pInst->compileCount > 0)
|
||||||
{
|
{
|
||||||
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\t%08x\n", m_allInstructions[i]->opname,
|
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\t%08x\n", pInst->opname,
|
||||||
m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount, m_allInstructions[i]->lastUse);
|
pInst->compileCount, pInst->runCount, pInst->lastUse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f.Open(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
|
f.Open(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
|
||||||
for (int i = 0; i < m_numInstructions; i++)
|
for (int i = 0; i < m_numInstructions; i++)
|
||||||
{
|
{
|
||||||
if (m_allInstructions[i]->compileCount == 0)
|
GekkoOPInfo *pInst = m_allInstructions[i];
|
||||||
|
if (pInst->compileCount == 0)
|
||||||
{
|
{
|
||||||
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\n", m_allInstructions[i]->opname,
|
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\n", pInst->opname,
|
||||||
m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount);
|
pInst->compileCount, pInst->runCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue