Fixup drk's profiler to work again and also support mVU...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3053 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2010-05-21 02:49:14 +00:00
parent c4e2bfefb7
commit e3cc848a72
7 changed files with 27 additions and 12 deletions

View File

@ -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);

View File

@ -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<ProfModules.size();i++)
{
rv+=ProfModules[i].ToString(tick_count);
wxString t = ProfModules[i].ToString(tick_count);
bool b0 = EmuConfig.Cpu.Recompiler.UseMicroVU0;
bool b1 = EmuConfig.Cpu.Recompiler.UseMicroVU1;
if ( b0 && b1) { if (t.Find(L"sVU") == -1) rT+=t;}
else if (!b0 && !b1) { if (t.Find(L"mVU") == -1) rT+=t;}
else if (!b0) { if (t.Find(L"mVU0") == -1) rT+=t;}
else if (!b1) { if (t.Find(L"mVU1") == -1) rT+=t;}
else rT+=t;
subtotal+=ProfModules[i].ticks;
ProfModules[i].ticks=0;
}
rv += wxsFormat( L" Total %d\n|", (subtotal*100) / (double)tick_count );
rT += wxsFormat( L"| Recs Total: %2.2f%% |", (float)(((double)subtotal*100.0) / (double)tick_count));
vector<MapType::mapped_type> 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)

View File

@ -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();
}

View File

@ -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;

View File

@ -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<microProgram*>();

View File

@ -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"

View File

@ -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];
}