Add VTune profiling support for Dolphin's JIT

This commit is contained in:
Pierre Bourdon 2012-08-05 16:39:15 +02:00
parent 228172d656
commit 80bf3c2c0b
2 changed files with 31 additions and 2 deletions

View File

@ -48,10 +48,14 @@
#if defined USE_OPROFILE && USE_OPROFILE
#include <opagent.h>
op_agent_t agent;
#endif
#if defined USE_OPROFILE && USE_OPROFILE
op_agent_t agent;
#if defined USE_VTUNE
#include <jitprofiling.h>
#pragma comment(lib, "libittnotify.lib")
#pragma comment(lib, "jitprofiling.lib")
#endif
using namespace Gen;
@ -121,6 +125,10 @@ bool JitBlock::ContainsAddress(u32 em_address)
#if defined USE_OPROFILE && USE_OPROFILE
op_close_agent(agent);
#endif
#ifdef USE_VTUNE
iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL);
#endif
}
// This clears the JIT cache. It's called from JitCache.cpp when the JIT cache
@ -232,6 +240,20 @@ bool JitBlock::ContainsAddress(u32 em_address)
op_write_native_code(agent, buf, (uint64_t)blockStart,
blockStart, b.codeSize);
#endif
#ifdef USE_VTUNE
sprintf(b.blockName, "EmuCode_0x%08x", b.originalAddress);
iJIT_Method_Load jmethod = {0};
jmethod.method_id = iJIT_GetNewMethodID();
jmethod.class_file_name = "";
jmethod.source_file_name = __FILE__;
jmethod.method_load_address = (void*)blockCodePointers[block_num];
jmethod.method_size = b.codeSize;
jmethod.line_number_size = 0;
jmethod.method_name = b.blockName;
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
#endif
}
const u8 **JitBlockCache::GetCodePointers()

View File

@ -24,6 +24,9 @@
#include "../Gekko.h"
#include "../PPCAnalyst.h"
// Define this in order to get VTune profile support for the Jit generated code.
// Add the VTune include/lib directories to the project directories to get this to build.
// #define USE_VTUNE
// emulate CPU with unlimited instruction cache
// the only way to invalidate a region is the "icbi" instruction
@ -66,6 +69,10 @@ struct JitBlock
u64 ticStop; // for profiling - time.
u64 ticCounter; // for profiling - time.
#endif
#ifdef USE_VTUNE
char blockName[32];
#endif
};
typedef void (*CompiledCode)();