summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorFiora <fioraaeterna@gmail.com>2014-10-05 00:08:07 -0700
committerFiora <fioraaeterna@gmail.com>2014-10-06 20:26:58 -0700
commit5919d0962fae220cc7d5dc45e0a76edd6ca9deaf (patch)
treef7cecc488990a03453e72543eaa1d1665ae797b8 /Source/Core
parent355a2d33aa6164320e52d3d2a3940936cf17217f (diff)
JIT: re-add profiling support on x86_64
Still gives rather inaccurate results with conditional continue and/or branch merging on, so those should probably be turned off when using it.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit.cpp1
-rw-r--r--Source/Core/Core/PowerPC/Profiler.h24
2 files changed, 24 insertions, 1 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
index de051b4bf9..81fa14fe5f 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
@@ -614,7 +614,6 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
js.next_inst_bp = false;
if (Profiler::g_ProfileBlocks)
{
- // CAUTION!!! push on stack regs you use, do your stuff, then pop
PROFILER_VPUSH;
// get end tic
PROFILER_QUERY_PERFORMANCE_COUNTER(&b->ticStop);
diff --git a/Source/Core/Core/PowerPC/Profiler.h b/Source/Core/Core/PowerPC/Profiler.h
index f1413e6f7b..34f6560d6a 100644
--- a/Source/Core/Core/PowerPC/Profiler.h
+++ b/Source/Core/Core/PowerPC/Profiler.h
@@ -7,6 +7,28 @@
#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)
// TODO: Implement generic ways to do this cleanly with all supported architectures
@@ -15,6 +37,8 @@
#define PROFILER_VPUSH
#define PROFILER_VPOP
+#endif
+
struct BlockStat
{
BlockStat(int bn, u64 c) : blockNum(bn), cost(c) {}