profiler: plug recompiler with new perf infra

Only EE/IOP support by block profiling

v2: cast wxString with ToUTF8 (windows)
This commit is contained in:
Gregory Hainaut 2015-12-07 09:26:25 +01:00
parent 92d7639267
commit 1c4b430984
4 changed files with 31 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "System/RecTypes.h"
#include "Utilities/MemsetFast.inl"
#include "Utilities/Perf.h"
// --------------------------------------------------------------------------------------
@ -56,6 +57,9 @@ void RecompiledCodeReserve::_registerProfiler()
if (m_profiler_name.IsEmpty() || !IsOk()) return;
ProfilerRegisterSource( m_profiler_name, m_baseptr, GetReserveSizeInBytes() );
m_profiler_registered = true;
// Could potentially be integrated into ProfilerRegisterSource
Perf::any.map((uptr)m_baseptr, GetReserveSizeInBytes(), m_profiler_name.ToUTF8());
}
void RecompiledCodeReserve::_termProfiler()

View File

@ -36,6 +36,7 @@
#include "NakedAsm.h"
#include "AppConfig.h"
#include "Utilities/Perf.h"
using namespace x86Emitter;
@ -361,6 +362,8 @@ static void _DynGen_Dispatchers()
HostSys::MemProtectStatic( iopRecDispatchers, PageAccess_ExecOnly() );
recBlocks.SetJITCompile( iopJITCompile );
Perf::any.map((uptr)&iopRecDispatchers, 4096, "IOP Dispatcher");
}
////////////////////////////////////////////////////
@ -812,6 +815,8 @@ void recResetIOP()
{
DevCon.WriteLn( "iR3000A Recompiler reset." );
Perf::iop.reset();
recAlloc();
recMem->Reset();
@ -868,6 +873,9 @@ static void recShutdown()
safe_free( s_pInstCache );
s_nInstCacheSize = 0;
// FIXME Warning thread unsafe
Perf::dump();
}
static void iopClearRecLUT(BASEBLOCK* base, int count)
@ -1411,6 +1419,8 @@ StartRecomp:
pxAssert(xGetPtr() - recPtr < _64kb);
s_pCurBlockEx->x86size = xGetPtr() - recPtr;
Perf::iop.map(s_pCurBlockEx->fnptr, s_pCurBlockEx->x86size, s_pCurBlockEx->startpc);
recPtr = xGetPtr();
pxAssert( (g_psxHasConstReg&g_psxFlushedConstReg) == g_psxHasConstReg );

View File

@ -41,6 +41,7 @@
#include "Utilities/MemsetFast.inl"
#include "Utilities/Perf.h"
using namespace x86Emitter;
@ -574,6 +575,8 @@ static void _DynGen_Dispatchers()
HostSys::MemProtectStatic( eeRecDispatchers, PageAccess_ExecOnly() );
recBlocks.SetJITCompile( JITCompile );
Perf::any.map((uptr)&eeRecDispatchers, 4096, "EE Dispatcher");
}
@ -699,6 +702,8 @@ static bool eeCpuExecuting = false;
////////////////////////////////////////////////////
static void recResetRaw()
{
Perf::ee.reset();
EE::Profiler.Reset();
recAlloc();
@ -744,6 +749,9 @@ static void recShutdown()
safe_aligned_free( recConstBuf );
safe_free( s_pInstCache );
s_nInstCacheSize = 0;
// FIXME Warning thread unsafe
Perf::dump();
}
static void recResetEE()
@ -840,6 +848,9 @@ static void recExecute()
if(m_cpuException) m_cpuException->Rethrow();
if(m_Exception) m_Exception->Rethrow();
// FIXME Warning thread unsafe
Perf::dump();
#endif
EE::Profiler.Print();
@ -2198,6 +2209,7 @@ StartRecomp:
iDumpBlock(s_pCurBlockEx->startpc, s_pCurBlockEx->size*4, s_pCurBlockEx->fnptr, s_pCurBlockEx->x86size);
}
#endif
Perf::ee.map(s_pCurBlockEx->fnptr, s_pCurBlockEx->x86size, s_pCurBlockEx->startpc);
recPtr = xGetPtr();

View File

@ -18,6 +18,8 @@
#include "PrecompiledHeader.h"
#include "microVU.h"
#include "Utilities/Perf.h"
//------------------------------------------------------------------
// Micro VU - Main Functions
//------------------------------------------------------------------
@ -73,6 +75,9 @@ void mVUreset(microVU& mVU, bool resetReserve) {
// Restore reserve to uncommitted state
if (resetReserve) mVU.cache_reserve->Reset();
if (mVU.index) Perf::any.map((uptr)&mVU.dispCache, mVUdispCacheSize, "mVU1 Dispatcher");
else Perf::any.map((uptr)&mVU.dispCache, mVUdispCacheSize, "mVU0 Dispatcher");
x86SetPtr(mVU.dispCache);
mVUdispatcherA(mVU);