Core: In compiling a block be able to trace the time to compile
This commit is contained in:
parent
5750d3df80
commit
4a42466559
|
@ -327,9 +327,12 @@ void CRecompiler::RecompilerMain_ChangeMemory()
|
||||||
}
|
}
|
||||||
|
|
||||||
CCompiledFunc * CRecompiler::CompileCode()
|
CCompiledFunc * CRecompiler::CompileCode()
|
||||||
|
{
|
||||||
|
if (g_ModuleLogLevel[TraceRecompiler] >= TraceDebug)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "Start (PC: %016llX)", PROGRAM_COUNTER);
|
WriteTrace(TraceRecompiler, TraceDebug, "Start (PC: %016llX)", PROGRAM_COUNTER);
|
||||||
|
m_RecompStartTime.SetToNow();
|
||||||
|
}
|
||||||
uint32_t pAddr = 0;
|
uint32_t pAddr = 0;
|
||||||
if (!m_MMU.VAddrToPAddr((uint32_t)PROGRAM_COUNTER, pAddr))
|
if (!m_MMU.VAddrToPAddr((uint32_t)PROGRAM_COUNTER, pAddr))
|
||||||
{
|
{
|
||||||
|
@ -392,33 +395,15 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
|
|
||||||
#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64)
|
#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64)
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
#else
|
#endif
|
||||||
if (g_ModuleLogLevel[TraceRecompiler] >= TraceDebug)
|
if (g_ModuleLogLevel[TraceRecompiler] >= TraceDebug)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "Info->Function() = %X", Func->Function());
|
m_RecompEndTime.SetToNow();
|
||||||
std::string dumpline;
|
uint32_t TimeTakenMicroseconds = (uint32_t)(m_RecompEndTime.GetMicroSeconds() - m_RecompStartTime.GetMicroSeconds());
|
||||||
uint32_t start_address = (uint32_t)(Func->Function()) & ~1;
|
uint32_t seconds = TimeTakenMicroseconds / 1000000;
|
||||||
for (uint8_t *ptr = (uint8_t *)start_address, *ptr_end = ((uint8_t *)start_address) + CodeLen; ptr < ptr_end; ptr++)
|
uint32_t microseconds = TimeTakenMicroseconds % 1000000;
|
||||||
{
|
WriteTrace(TraceRecompiler, TraceDebug, "Done (TimeTaken: %u.%06u seconds)", seconds, microseconds);
|
||||||
if (dumpline.empty())
|
|
||||||
{
|
|
||||||
dumpline += stdstr_f("%X: ", ptr);
|
|
||||||
}
|
}
|
||||||
dumpline += stdstr_f(" %02X", *ptr);
|
|
||||||
if ((((uint32_t)ptr - start_address) + 1) % 30 == 0)
|
|
||||||
{
|
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "%s", dumpline.c_str());
|
|
||||||
dumpline.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dumpline.empty())
|
|
||||||
{
|
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "%s", dumpline.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
WriteTrace(TraceRecompiler, TraceVerbose, "Done");
|
|
||||||
return Func;
|
return Func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,4 +89,6 @@ private:
|
||||||
FUNCTION_PROFILE m_BlockProfile;
|
FUNCTION_PROFILE m_BlockProfile;
|
||||||
uint64_t & PROGRAM_COUNTER;
|
uint64_t & PROGRAM_COUNTER;
|
||||||
CLog * m_LogFile;
|
CLog * m_LogFile;
|
||||||
|
HighResTimeStamp m_RecompStartTime;
|
||||||
|
HighResTimeStamp m_RecompEndTime;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue