mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-23 14:24:52 +00:00
Add kernelstats
Useful for finding out if some syscall takes unexpectedly much CPU.
This commit is contained in:
parent
10f69ed000
commit
f3749d8abe
@ -15,6 +15,7 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/timeutil.h"
|
||||
#include "HLE.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@ -344,6 +345,8 @@ inline void hleFinishSyscall(int modulenum, int funcnum)
|
||||
|
||||
void CallSyscall(u32 op)
|
||||
{
|
||||
time_update();
|
||||
double start = time_now_d();
|
||||
u32 callno = (op >> 6) & 0xFFFFF; //20 bits
|
||||
int funcnum = callno & 0xFFF;
|
||||
int modulenum = (callno & 0xFF000) >> 12;
|
||||
@ -365,4 +368,14 @@ void CallSyscall(u32 op)
|
||||
{
|
||||
ERROR_LOG(HLE,"Unimplemented HLE function %s", moduleDB[modulenum].funcTable[funcnum].name);
|
||||
}
|
||||
time_update();
|
||||
double total = time_now_d() - start;
|
||||
if (total > kernelStats.slowestSyscallTime) {
|
||||
const char *name = moduleDB[modulenum].funcTable[funcnum].name;
|
||||
if (0 != strcmp(name, "_sceKernelIdle")) {
|
||||
kernelStats.slowestSyscallTime = total;
|
||||
kernelStats.slowestSyscallName = name;
|
||||
}
|
||||
}
|
||||
kernelStats.msInSyscalls += total;
|
||||
}
|
||||
|
@ -71,6 +71,7 @@
|
||||
|
||||
static bool kernelRunning = false;
|
||||
KernelObjectPool kernelObjects;
|
||||
KernelStats kernelStats;
|
||||
|
||||
void __KernelInit()
|
||||
{
|
||||
|
@ -377,6 +377,7 @@ public:
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T* GetByModuleByEntryAddr(u32 entryAddr)
|
||||
{
|
||||
@ -410,13 +411,32 @@ public:
|
||||
int GetCount();
|
||||
|
||||
private:
|
||||
enum {maxCount=4096, handleOffset=0x100};
|
||||
enum {
|
||||
maxCount=4096,
|
||||
handleOffset=0x100
|
||||
};
|
||||
KernelObject *pool[maxCount];
|
||||
bool occupied[maxCount];
|
||||
};
|
||||
|
||||
extern KernelObjectPool kernelObjects;
|
||||
|
||||
struct KernelStats {
|
||||
void Reset() {
|
||||
memset(this, 0, sizeof(this));
|
||||
}
|
||||
void ResetFrame() {
|
||||
msInSyscalls = 0;
|
||||
slowestSyscallTime = 0;
|
||||
slowestSyscallName = 0;
|
||||
}
|
||||
|
||||
double msInSyscalls;
|
||||
double slowestSyscallTime;
|
||||
const char *slowestSyscallName;
|
||||
};
|
||||
|
||||
extern KernelStats kernelStats;
|
||||
|
||||
void Register_ThreadManForUser();
|
||||
void Register_LoadExecForUser();
|
||||
|
Loading…
x
Reference in New Issue
Block a user