mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 16:30:30 +02:00
Add kernelstats
Useful for finding out if some syscall takes unexpectedly much CPU.
This commit is contained in:
1 parent
10f69ed000
commit
f3749d8abe
3 files changed
+35
-1
No files matched your search
@@ -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()
|
||||
{
|
||||
|
||||
+21
-1
@@ -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();
|
||||
Reference in new issue
Block a user