Merge branch 'master' into armjit

This commit is contained in:
Henrik Rydgard 2013-01-11 23:48:42 +01:00
commit 0663f471a2
6 changed files with 89 additions and 39 deletions

View File

@ -39,7 +39,6 @@ option(IOS "Set to ON if targeting an iOS device" ${IOS})
option(USING_GLES2 "Set to ON if target device uses OpenGL ES 2.0" ${USING_GLES2})
option(USING_QT_UI "Set to ON if you wish to use the Qt frontend wrapper" ${USING_QT_UI})
option(HEADLESS "Set to OFF to not generate the PPSSPPHeadless target" ${HEADLESS})
option(DEBUG "Set to ON to enable full debug logging" ${DEBUG})
if(ANDROID)
if(NOT ANDROID_ABI)
@ -103,9 +102,8 @@ if(USING_GLES2)
add_definitions(-DUSING_GLES2)
endif()
if(DEBUG)
add_definitions(-D_DEBUG)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG")
if(NOT MSVC)
# Disable some warnings

View File

@ -162,7 +162,7 @@ IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle)
return 0;
}
bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath, IFileSystem **system)
bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath, MountPoint **system)
{
std::string realpath;
@ -197,7 +197,7 @@ bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpat
if (strncasecmp(fileSystems[i].prefix.c_str(), realpath.c_str(), prefLen) == 0)
{
outpath = realpath.substr(prefLen);
*system = fileSystems[i].system;
*system = &(fileSystems[i]);
DEBUG_LOG(HLE, "MapFilePath: mapped \"%s\" to prefix: \"%s\", path: \"%s\"", inpath.c_str(), fileSystems[i].prefix.c_str(), outpath.c_str());
@ -212,7 +212,7 @@ bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpat
void MetaFileSystem::Mount(std::string prefix, IFileSystem *system)
{
System x;
MountPoint x;
x.prefix=prefix;
x.system=system;
fileSystems.push_back(x);
@ -304,10 +304,10 @@ void MetaFileSystem::ChDir(const std::string &dir)
int curThread = __KernelGetCurThread();
std::string of;
IFileSystem *system;
if (MapFilePath(dir, of, &system))
MountPoint *mountPoint;
if (MapFilePath(dir, of, &mountPoint))
{
currentDir[curThread] = of;
currentDir[curThread] = mountPoint->prefix + of;
//return true;
}
else

View File

@ -21,6 +21,20 @@
class MetaFileSystem : public IHandleAllocator, public IFileSystem
{
private:
u32 current;
struct MountPoint
{
std::string prefix;
IFileSystem *system;
};
std::vector<MountPoint> fileSystems;
typedef std::map<int, std::string> currentDir_t;
currentDir_t currentDir;
std::string startingDirectory;
public:
MetaFileSystem()
{
@ -40,7 +54,19 @@ public:
virtual void DoState(PointerWrap &p);
IFileSystem *GetHandleOwner(u32 handle);
bool MapFilePath(const std::string &inpath, std::string &outpath, IFileSystem **system);
bool MapFilePath(const std::string &inpath, std::string &outpath, MountPoint **system);
inline bool MapFilePath(const std::string &_inpath, std::string &outpath, IFileSystem **system)
{
MountPoint *mountPoint;
if (MapFilePath(_inpath, outpath, &mountPoint))
{
*system = mountPoint->system;
return true;
}
return false;
}
// Only possible if a file system is a DirectoryFileSystem or similar.
bool GetHostPath(const std::string &inpath, std::string &outpath);
@ -70,17 +96,4 @@ public:
void SetStartingDirectory(const std::string &dir) {
startingDirectory = dir;
}
private:
u32 current;
struct System
{
std::string prefix;
IFileSystem *system;
};
std::vector<System> fileSystems;
typedef std::map<int, std::string> currentDir_t;
currentDir_t currentDir;
std::string startingDirectory;
};

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;