Merge pull request #404 from unknownbrackets/more-stats

Show the most active syscall too
This commit is contained in:
Henrik Rydgård 2013-01-11 10:31:55 -08:00
commit 40dbdb8d4e
3 changed files with 54 additions and 15 deletions

View File

@ -343,6 +343,42 @@ inline void hleFinishSyscall(int modulenum, int funcnum)
hleAfterSyscallReschedReason[0] = 0;
}
inline void updateSyscallStats(int modulenum, int funcnum, double total)
{
const char *name = moduleDB[modulenum].funcTable[funcnum].name;
// Ignore this one, especially for msInSyscalls (although that ignores CoreTiming events.)
if (0 == strcmp(name, "_sceKernelIdle"))
return;
if (total > kernelStats.slowestSyscallTime)
{
kernelStats.slowestSyscallTime = total;
kernelStats.slowestSyscallName = name;
}
kernelStats.msInSyscalls += total;
KernelStatsSyscall statCall(modulenum, funcnum);
auto summedStat = kernelStats.summedMsInSyscalls.find(statCall);
if (summedStat == kernelStats.summedMsInSyscalls.end())
{
kernelStats.summedMsInSyscalls[statCall] = total;
if (total > kernelStats.summedSlowestSyscallTime)
{
kernelStats.summedSlowestSyscallTime = total;
kernelStats.summedSlowestSyscallName = name;
}
}
else
{
double newTotal = kernelStats.summedMsInSyscalls[statCall] += total;
if (newTotal > kernelStats.summedSlowestSyscallTime)
{
kernelStats.summedSlowestSyscallTime = newTotal;
kernelStats.summedSlowestSyscallName = name;
}
}
}
void CallSyscall(u32 op)
{
time_update();
@ -369,13 +405,5 @@ 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;
updateSyscallStats(modulenum, funcnum, time_now_d() - start);
}

View File

@ -214,12 +214,11 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
"DL processing time: %0.2f ms\n"
"Kernel processing time: %0.2f ms\n"
"Slowest syscall: %s : %0.2f ms\n"
"Draw calls: %i\n"
"Draw flushes: %i\n"
"Most active syscall: %s : %0.2f ms\n"
"Draw calls: %i, flushes %i\n"
"Vertices Transformed: %i\n"
"FBOs active: %i\n"
"Textures active: %i\n"
"Textures decoded: %i\n"
"Textures active: %i, decoded: %i\n"
"Texture invalidations: %i\n"
"Vertex shaders loaded: %i\n"
"Fragment shaders loaded: %i\n"
@ -229,6 +228,8 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
kernelStats.msInSyscalls * 1000.0f,
kernelStats.slowestSyscallName ? kernelStats.slowestSyscallName : "(none)",
kernelStats.slowestSyscallTime * 1000.0f,
kernelStats.summedSlowestSyscallName ? kernelStats.summedSlowestSyscallName : "(none)",
kernelStats.summedSlowestSyscallTime * 1000.0f,
gpuStats.numDrawCalls,
gpuStats.numFlushes,
gpuStats.numVertsTransformed,
@ -243,7 +244,9 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
float zoom = 0.5f; /// g_Config.iWindowZoom;
PPGeBegin();
PPGeDrawText(stats, 0, 0, 0, zoom, 0xFFc0c0c0);
PPGeDrawText(stats, 1, 1, 0, zoom, 0xFF000000);
PPGeDrawText(stats, -1, -1, 0, zoom, 0xFF000000);
PPGeDrawText(stats, 0, 0, 0, zoom, 0xFFFFFFFF);
PPGeEnd();
gpuStats.resetFrame();

View File

@ -421,19 +421,27 @@ private:
extern KernelObjectPool kernelObjects;
typedef std::pair<int, int> KernelStatsSyscall;
struct KernelStats {
void Reset() {
memset(this, 0, sizeof(*this));
ResetFrame();
}
void ResetFrame() {
msInSyscalls = 0;
slowestSyscallTime = 0;
slowestSyscallName = 0;
summedMsInSyscalls.clear();
summedSlowestSyscallTime = 0;
summedSlowestSyscallName = 0;
}
double msInSyscalls;
double slowestSyscallTime;
const char *slowestSyscallName;
std::map<KernelStatsSyscall, double> summedMsInSyscalls;
double summedSlowestSyscallTime;
const char *summedSlowestSyscallName;
};
extern KernelStats kernelStats;