remove fflush call on every single instruction trace, which can make modern SSD go totally dysfunctional. attempt to recover from this by flushing once a frame and whenever emulation pauses, so that you have a flushed trace file while debugging or whenever the main menu is interactive.

This commit is contained in:
zeromus 2022-04-26 13:22:22 -04:00
parent 4ed47577bd
commit def5768b9e
3 changed files with 16 additions and 1 deletions

View File

@ -330,6 +330,9 @@ void FCEUD_DebugBreakpoint(int bp_num);
///the driver should log the current instruction, if it wants (we should move the code in the win driver that does this to the shared area)
void FCEUD_TraceInstruction(uint8 *opcode, int size);
///the driver should flush its trace log
void FCEUD_FlushTrace();
///the driver might should update its NTView (only used if debugging support is compiled in)
void FCEUD_UpdateNTView(int scanline, bool drawall);

View File

@ -732,6 +732,12 @@ void BeginLoggingSequence(void)
return;
}
void FCEUD_FlushTrace()
{
if(LOG_FP)
fflush(LOG_FP);
}
//todo: really speed this up
void FCEUD_TraceInstruction(uint8 *opcode, int size)
{
@ -975,7 +981,6 @@ void OutputLogLine(const char *str, std::vector<uint16>* addressesLog, bool add_
fputs(str, LOG_FP);
if (add_newline)
fputs("\n", LOG_FP);
fflush(LOG_FP);
} else
{
if (add_newline)

View File

@ -808,6 +808,9 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
if (skip != 2) ssize = FlushEmulateSound(); //If skip = 2 we are skipping sound processing
//flush tracer once a frame, since we're likely to end up back at a user interaction loop after this with emulation paused
FCEUD_FlushTrace();
#ifdef _S9XLUA_H
CallRegisteredLuaFunctions(LUACALL_AFTEREMULATION);
#endif
@ -1228,12 +1231,16 @@ void FCEUI_ClearEmulationFrameStepped()
//ideally maybe we shouldnt be using this, but i need it for quick merging
void FCEUI_SetEmulationPaused(int val) {
EmulationPaused = val;
if(EmulationPaused)
FCEUD_FlushTrace();
}
void FCEUI_ToggleEmulationPause(void)
{
EmulationPaused = (EmulationPaused & EMULATIONPAUSED_PAUSED) ^ EMULATIONPAUSED_PAUSED;
DebuggerWasUpdated = false;
if(EmulationPaused)
FCEUD_FlushTrace();
}
void FCEUI_FrameAdvanceEnd(void) {