Merge pull request #1224 from FioraAeterna/profile

JIT: re-add profiling support on x86_64
This commit is contained in:
comex 2014-10-07 02:31:04 -04:00
commit 85086e1e6c
2 changed files with 24 additions and 1 deletions

View File

@ -614,7 +614,6 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
js.next_inst_bp = false; js.next_inst_bp = false;
if (Profiler::g_ProfileBlocks) if (Profiler::g_ProfileBlocks)
{ {
// CAUTION!!! push on stack regs you use, do your stuff, then pop
PROFILER_VPUSH; PROFILER_VPUSH;
// get end tic // get end tic
PROFILER_QUERY_PERFORMANCE_COUNTER(&b->ticStop); PROFILER_QUERY_PERFORMANCE_COUNTER(&b->ticStop);

View File

@ -7,6 +7,28 @@
#include <string> #include <string>
#ifdef _WIN32
#define PROFILER_QUERY_PERFORMANCE_COUNTER(pt) \
LEA(64, ABI_PARAM1, M(pt)); \
CALL(QueryPerformanceCounter)
// asm write : (u64) dt += t1-t0
#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) \
MOV(64, R(RSCRATCH), M(pt1)); \
SUB(64, R(RSCRATCH), M(pt0)); \
ADD(64, R(RSCRATCH), M(pdt)); \
MOV(64, M(pdt), R(RSCRATCH));
#define PROFILER_VPUSH \
u32 registersInUse = CallerSavedRegistersInUse(); \
ABI_PushRegistersAndAdjustStack(registersInUse, 0);
#define PROFILER_VPOP \
ABI_PopRegistersAndAdjustStack(registersInUse, 0);
#else
#define PROFILER_QUERY_PERFORMANCE_COUNTER(pt) #define PROFILER_QUERY_PERFORMANCE_COUNTER(pt)
// TODO: Implement generic ways to do this cleanly with all supported architectures // TODO: Implement generic ways to do this cleanly with all supported architectures
@ -15,6 +37,8 @@
#define PROFILER_VPUSH #define PROFILER_VPUSH
#define PROFILER_VPOP #define PROFILER_VPOP
#endif
struct BlockStat struct BlockStat
{ {
BlockStat(int bn, u64 c) : blockNum(bn), cost(c) {} BlockStat(int bn, u64 c) : blockNum(bn), cost(c) {}