gsdx: improve builtin profiler

* Does the first vsync (start counter) after the sleep
* Dump data after the rendering, avoid to count extra destructor,sleep time
* Dump data into a basic csv file (if people want nice graph)
This commit is contained in:
Gregory Hainaut 2016-07-08 21:47:53 +02:00
parent 8b3e04d1b6
commit 3f03f7333c
2 changed files with 17 additions and 9 deletions

View File

@ -1569,9 +1569,6 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
file->Read(regs, 0x2000);
GSvsync(1);
while(!file->IsEof())
{
uint8 type;
@ -1628,7 +1625,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
delete file;
}
sleep(1);
sleep(2);
//while(IsWindowVisible(hWnd))
//FIXME map?
@ -1638,6 +1635,10 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
finished = 1;
}
unsigned long frame_number = 0;
// Init vsync stuff
GSvsync(1);
while(finished > 0)
{
for(auto i = packets.begin(); i != packets.end(); i++)
@ -1690,6 +1691,8 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
}
}
static_cast<GSDeviceOGL*>(s_gs->m_dev)->GenerateProfilerData();
#ifdef ENABLE_OGL_DEBUG_MEM_BW
unsigned long total_frame_nb = std::max(1ul, frame_number) << 10;
fprintf(stderr, "memory bandwith. T: %f KB/f. V: %f KB/f. U: %f KB/f\n",
@ -1706,7 +1709,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
packets.clear();
sleep(1);
sleep(2);
GSclose();
GSshutdown();

View File

@ -95,10 +95,6 @@ GSDeviceOGL::~GSDeviceOGL()
GL_PUSH("GSDeviceOGL destructor");
if (GLLoader::in_replayer) {
GenerateProfilerData();
}
// Clean vertex buffer state
delete m_va;
@ -194,6 +190,15 @@ void GSDeviceOGL::GenerateProfilerData()
fprintf(stderr, "Max %4.2f ms\t(%4.2f fps)\n", *minmax_time.second, 1000.0 / *minmax_time.second);
fprintf(stderr, "SD %4.2f ms\n", sd);
fprintf(stderr, "\n");
FILE* csv = fopen("GSdx_profile.csv", "w");
if (csv) {
for (size_t i = 0; i < times.size(); i++) {
fprintf(csv, "%d,%lf\n", i, times[i]);
}
fclose(csv);
}
}
GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int fmt)