diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp index f262898474..a9297f0fbf 100644 --- a/pcsx2/R5900.cpp +++ b/pcsx2/R5900.cpp @@ -31,6 +31,7 @@ #include "CDVD/CDVD.h" #include "Patch.h" #include "DataBase_Loader.h" +#include "SamplProf.h" using namespace R5900; // for R5900 disasm tools @@ -612,6 +613,8 @@ void __fastcall eeGameStarting() GetMTGS().SendGameCRC(ElfCRC); g_GameStarted = true; + + if (0) ProfilerSetEnabled(true); } ApplyPatch(0); diff --git a/pcsx2/windows/SamplProf.cpp b/pcsx2/windows/SamplProf.cpp index fb51ed6f82..2c3276975f 100644 --- a/pcsx2/windows/SamplProf.cpp +++ b/pcsx2/windows/SamplProf.cpp @@ -42,7 +42,7 @@ struct Module } wxString ToString(u32 total_ticks) { - return wxsFormat( L"%s: %d ", name, (ticks*100) / (double)total_ticks ); + return wxsFormat( L"| %s: %2.2f%% |", name.c_str(), (float)(((double)ticks*100.0) / (double)total_ticks) ); } bool Inside(uptr val) { return val>=base && val<=end; } void FromAddress(const void* ptr,bool getname) @@ -209,16 +209,25 @@ int __stdcall ProfilerThread(void* nada) if (tick_count>500) { - wxString rv = L"|"; + wxString rT = L""; + wxString rv = L""; u32 subtotal=0; for (size_t i=0;i lst; for (MapType::iterator i=ProfUnknownHash.begin();i!=ProfUnknownHash.end();i++) { @@ -231,7 +240,8 @@ int __stdcall ProfilerThread(void* nada) rv += lst[i].ToString(tick_count); } - Console.WriteLn( L"+Sampling Profiler Results-\n%s\n+>", rv.c_str() ); + Console.WriteLn( L"Sampling Profiler Results:\n%s\n%s\n", rT.c_str(), rv.c_str() ); + Console.SetTitle(rT); tick_count=0; @@ -265,7 +275,7 @@ void ProfilerInit() if (ProfRunning) return; - //Console.Msg( "Profiler Thread Initializing..." ); + Console.Write( "Profiler Thread Initializing..." ); ProfRunning=true; DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), @@ -279,12 +289,12 @@ void ProfilerInit() hProfThread=CreateThread(0,0,(LPTHREAD_START_ROUTINE)ProfilerThread,0,0,0); SetThreadPriority(hProfThread,THREAD_PRIORITY_HIGHEST); - //Console.WriteLn( " Done!" ); + Console.WriteLn( " Done!" ); } void ProfilerTerm() { - //Console.Msg( "Profiler Terminating..." ); + Console.Write( "Profiler Terminating..." ); if (!ProfRunning) return; @@ -304,7 +314,7 @@ void ProfilerTerm() CloseHandle( hMtgsThread ); DeleteCriticalSection( &ProfModulesLock ); - //Console.WriteLn( " Done!" ); + Console.WriteLn( " Done!" ); } void ProfilerSetEnabled(bool Enabled) diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 3990604647..df0db2c1a6 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -798,7 +798,7 @@ static void recAlloc() if( s_pInstCache == NULL ) throw Exception::OutOfMemory( "R3000a Init > Failed to allocate memory for pInstCache." ); - ProfilerRegisterSource( "IOPRec", recMem, RECMEM_SIZE ); + ProfilerRegisterSource( "IOP Rec", recMem, RECMEM_SIZE ); _DynGen_Dispatchers(); } diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 2e830dba5c..eb2635106c 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -601,7 +601,7 @@ static void recAlloc() // No errors.. Proceed with initialization: - ProfilerRegisterSource( "EERec", recMem, REC_CACHEMEM+0x1000 ); + ProfilerRegisterSource( "EE Rec", recMem, REC_CACHEMEM+0x1000 ); _DynGen_Dispatchers(); x86FpuState = FPU_STATE; diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index 00bdee6015..5d201179ae 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -98,6 +98,7 @@ _f void mVUinit(VURegs* vuRegsPtr, int vuIndex) { if (!mVU->cache) throw Exception::OutOfMemory( "microVU Error: Failed to allocate recompiler memory!" ); memset(mVU->cache, 0xcc, mVU->cacheSize + 0x1000); + ProfilerRegisterSource(isVU1?"mVU1 Rec":"mVU0 Rec", mVU->cache, mVU->cacheSize); for (u32 i = 0; i < (mVU->progSize / 2); i++) { mVU->prog.prog[i].list = new deque(); diff --git a/pcsx2/x86/microVU.h b/pcsx2/x86/microVU.h index 36d0147442..90b7d2ca4d 100644 --- a/pcsx2/x86/microVU.h +++ b/pcsx2/x86/microVU.h @@ -25,6 +25,7 @@ using namespace x86Emitter; #include "iR5900.h" #include "R5900OpcodeTables.h" #include "x86emitter/x86emitter.h" +#include "SamplProf.h" #include "microVU_IR.h" #include "microVU_Misc.h" diff --git a/pcsx2/x86/sVU_zerorec.cpp b/pcsx2/x86/sVU_zerorec.cpp index 9a7c6238f7..f3a6f828bc 100644 --- a/pcsx2/x86/sVU_zerorec.cpp +++ b/pcsx2/x86/sVU_zerorec.cpp @@ -366,7 +366,7 @@ static void SuperVUAlloc(int vuindex) ); } - ProfilerRegisterSource("VURec", s_recVUMem, VU_EXESIZE); + ProfilerRegisterSource("sVU Rec", s_recVUMem, VU_EXESIZE); if (recVUStack == NULL) recVUStack = new u8[SUPERVU_STACKSIZE * 4]; }