ADDED average performance logging. Enable with LOG_PERFORMANCE. Optionally change frame interval with PERFORMANCE_INTERVAL = x frames

This commit is contained in:
spacy51 2008-01-26 11:46:37 +00:00
parent e9b1f58575
commit 22def723e4
2 changed files with 32 additions and 0 deletions

View File

@ -1,4 +1,6 @@
Important: Important:
- Close all dialogs (like logging) before entering fullscreen to prevent dead-lock with D3D
- Many games show emulation warnings in the log window (unaligned read, bad read/write address) - Many games show emulation warnings in the log window (unaligned read, bad read/write address)
- Test: Metroid Fusion, Advance Wars 2 - Test: Metroid Fusion, Advance Wars 2

View File

@ -186,6 +186,14 @@ namespace Sm60FPS
int bSaveMoreCPU; int bSaveMoreCPU;
}; };
#ifdef LOG_PERFORMANCE
#ifndef PERFORMANCE_INTERVAL
#define PERFORMANCE_INTERVAL 3600
#endif
int systemSpeedTable[PERFORMANCE_INTERVAL];
unsigned int systemSpeedCounter;
#endif
void directXMessage(const char *msg) void directXMessage(const char *msg)
{ {
systemMessage(IDS_DIRECTX_7_REQUIRED, systemMessage(IDS_DIRECTX_7_REQUIRED,
@ -880,6 +888,11 @@ void VBA::updateFilter()
systemBlueShift = 0; systemBlueShift = 0;
utilUpdateSystemColorMaps(); utilUpdateSystemColorMaps();
} }
#ifdef LOG_PERFORMANCE
memset( systemSpeedTable, 0x00, sizeof(systemSpeedTable) );
systemSpeedCounter = 0;
#endif
} }
@ -1092,6 +1105,10 @@ void systemFrame()
if( theApp.movieRecording || theApp.moviePlaying ) { if( theApp.movieRecording || theApp.moviePlaying ) {
theApp.movieFrame++; theApp.movieFrame++;
} }
#ifdef LOG_PERFORMANCE
systemSpeedTable[systemSpeedCounter++ % PERFORMANCE_INTERVAL] = systemSpeed;
#endif
} }
@ -1125,6 +1142,19 @@ void system10Frames(int rate)
} }
theApp.wasPaused = false; theApp.wasPaused = false;
#ifdef LOG_PERFORMANCE
if( systemSpeedCounter >= PERFORMANCE_INTERVAL ) {
// log performance every PERFORMANCE_INTERVAL frames
float a = 0.0f;
for( unsigned short i = 0 ; i < PERFORMANCE_INTERVAL ; i++ ) {
a += (float)systemSpeedTable[i];
}
a /= (float)PERFORMANCE_INTERVAL;
log( _T("Speed: %f\n"), a );
systemSpeedCounter = 0;
}
#endif
} }
void systemScreenMessage(const char *msg) void systemScreenMessage(const char *msg)