diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2018-08-27 18:02:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-27 18:02:59 +0200 |
| commit | f7b334817d0c200037cf3d86b6eb10f7f4b123ca (patch) | |
| tree | f3f0701b6e7744d95176587f9f23e426016ee9e8 /Source/Core | |
| parent | 88a91562b542f2066f14a0205aeea50f6d1d6125 (diff) | |
| parent | 7aa305ea358ee1574f1036493411aa2cdf86458f (diff) | |
Merge pull request #7371 from lioncash/global
Profiler: Migrate global g_ProfileBlocks to JitOptions
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64/Jit.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/JitCommon/JitBase.h | 1 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/JitInterface.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/JitInterface.h | 7 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/Profiler.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/Profiler.h | 2 |
7 files changed, 22 insertions, 10 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 55dda966c5..44f1b8566f 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -382,7 +382,7 @@ bool Jit64::Cleanup() did_something = true; } - if (Profiler::g_ProfileBlocks) + if (jo.profile_blocks) { ABI_PushRegistersAndAdjustStack({}, 0); // get end tic @@ -608,7 +608,7 @@ void Jit64::Jit(u32 em_address) EnableOptimization(); // Comment out the following to disable breakpoints (speed-up) - if (!Profiler::g_ProfileBlocks) + if (!jo.profile_blocks) { if (CPU::IsStepping()) { @@ -680,7 +680,7 @@ u8* Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) } // Conditionally add profiling code. - if (Profiler::g_ProfileBlocks) + if (jo.profile_blocks) { // get start tic MOV(64, R(ABI_PARAM1), ImmPtr(&b->profile_data.ticStart)); diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 05dee817b6..faee0210ff 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -510,7 +510,7 @@ void JitArm64::BeginTimeProfile(JitBlock* b) void JitArm64::EndTimeProfile(JitBlock* b) { - if (!Profiler::g_ProfileBlocks) + if (!jo.profile_blocks) return; // Fetch the current counter register @@ -622,7 +622,7 @@ void JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) b->normalEntry = GetWritableCodePtr(); // Conditionally add profiling code. - if (Profiler::g_ProfileBlocks) + if (jo.profile_blocks) { // get start tic BeginTimeProfile(b); diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.h b/Source/Core/Core/PowerPC/JitCommon/JitBase.h index db906dd995..90cd71ac87 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitBase.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.h @@ -53,6 +53,7 @@ protected: bool accurateSinglePrecision; bool fastmem; bool memcheck; + bool profile_blocks; }; struct JitState { diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index 7ca7ebaeb5..07db190f29 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -79,6 +79,14 @@ CPUCoreBase* GetCore() return g_jit; } +void SetProfilingState(ProfilingState state) +{ + if (!g_jit) + return; + + g_jit->jo.profile_blocks = state == ProfilingState::Enabled; +} + void WriteProfileResults(const std::string& filename) { Profiler::ProfileStats prof_stats; diff --git a/Source/Core/Core/PowerPC/JitInterface.h b/Source/Core/Core/PowerPC/JitInterface.h index 913e34148a..6fb88fe1d1 100644 --- a/Source/Core/Core/PowerPC/JitInterface.h +++ b/Source/Core/Core/PowerPC/JitInterface.h @@ -37,6 +37,13 @@ CPUCoreBase* InitJitCore(PowerPC::CPUCore core); CPUCoreBase* GetCore(); // Debugging +enum class ProfilingState +{ + Enabled, + Disabled +}; + +void SetProfilingState(ProfilingState state); void WriteProfileResults(const std::string& filename); void GetProfileResults(Profiler::ProfileStats* prof_stats); int GetHostCode(u32* address, const u8** code, u32* code_size); diff --git a/Source/Core/Core/PowerPC/Profiler.cpp b/Source/Core/Core/PowerPC/Profiler.cpp index 0378c4a5b5..56038e039c 100644 --- a/Source/Core/Core/PowerPC/Profiler.cpp +++ b/Source/Core/Core/PowerPC/Profiler.cpp @@ -10,11 +10,9 @@ namespace Profiler { -bool g_ProfileBlocks = false; - void WriteProfileResults(const std::string& filename) { JitInterface::WriteProfileResults(filename); } -} // namespace +} // namespace Profiler diff --git a/Source/Core/Core/PowerPC/Profiler.h b/Source/Core/Core/PowerPC/Profiler.h index 019dd7865c..dee4a24194 100644 --- a/Source/Core/Core/PowerPC/Profiler.h +++ b/Source/Core/Core/PowerPC/Profiler.h @@ -12,8 +12,6 @@ namespace Profiler { -extern bool g_ProfileBlocks; - struct BlockStat { BlockStat(u32 _addr, u64 c, u64 ticks, u64 run, u32 size) |
