mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #2394 from Sonicadvance1/android_block_profiling_api
[Android] Block profiling JNI interface
This commit is contained in:
commit
0c5f5c4519
@ -206,6 +206,17 @@ public final class NativeLibrary
|
||||
/** Stops emulation. */
|
||||
public static native void StopEmulation();
|
||||
|
||||
/**
|
||||
* Enables or disables CPU block profiling
|
||||
* @param enable
|
||||
*/
|
||||
public static native void SetProfiling(boolean enable);
|
||||
|
||||
/**
|
||||
* Writes out the block profile results
|
||||
*/
|
||||
public static native void WriteProfileResults();
|
||||
|
||||
/** Native EGL functions not exposed by Java bindings **/
|
||||
public static native void eglBindAPI(int api);
|
||||
|
||||
|
@ -120,6 +120,10 @@ namespace JitInterface
|
||||
if (!jit)
|
||||
return;
|
||||
|
||||
PowerPC::CPUState old_state = PowerPC::GetState();
|
||||
if (old_state == PowerPC::CPUState::CPU_RUNNING)
|
||||
PowerPC::Pause();
|
||||
|
||||
std::vector<BlockStat> stats;
|
||||
stats.reserve(jit->GetBlockCache()->GetNumBlocks());
|
||||
u64 cost_sum = 0;
|
||||
@ -161,6 +165,9 @@ namespace JitInterface
|
||||
(double)block->ticCounter*1000.0/(double)countsPerSec, block->codeSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (old_state == PowerPC::CPUState::CPU_RUNNING)
|
||||
PowerPC::Start();
|
||||
}
|
||||
bool HandleFault(uintptr_t access_address, SContext* ctx)
|
||||
{
|
||||
|
@ -22,7 +22,9 @@
|
||||
#include "Core/Host.h"
|
||||
#include "Core/State.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/PowerPC/JitInterface.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/PowerPC/Profiler.h"
|
||||
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
|
||||
@ -365,6 +367,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JN
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFolders(JNIEnv *env, jobject obj);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(JNIEnv *env, jobject obj, jstring jDirectory);
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDirectory(JNIEnv *env, jobject obj);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv *env, jobject obj, jboolean enable);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv *env, jobject obj);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf);
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv *env, jobject obj)
|
||||
@ -546,6 +550,21 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDi
|
||||
return env->NewStringUTF(File::GetUserPath(D_USER_IDX).c_str());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv *env, jobject obj, jboolean enable)
|
||||
{
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
JitInterface::ClearCache();
|
||||
Profiler::g_ProfileBlocks = enable;
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv *env, jobject obj)
|
||||
{
|
||||
std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt";
|
||||
File::CreateFullPath(filename);
|
||||
JitInterface::WriteProfileResults(filename);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf)
|
||||
{
|
||||
surf = ANativeWindow_fromSurface(env, _surf);
|
||||
|
Loading…
Reference in New Issue
Block a user