commit 74e8a59d2ff47a8720971815ceccf41569baed1f
parent ea0584a249d03dd454d3749ca505a3cd62ccb217
Author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
Date: Wed, 19 May 2021 07:29:00 +0000
bench mode (disabled by default)
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
@@ -26,7 +26,7 @@ static Apu apu[POLYPHONY];
static Mpu mpu;
static Device *devscreen, *devmouse, *devctrl, *devmidi, *devaudio0;
-Uint8 zoom = 0, debug = 0, reqdraw = 0;
+Uint8 zoom = 0, debug = 0, reqdraw = 0, bench = 0;
int
clamp(int val, int min, int max)
@@ -323,7 +323,9 @@ start(Uxn *u)
while(1) {
int i;
SDL_Event event;
- double elapsed, start = SDL_GetPerformanceCounter();
+ double elapsed, start;
+ if(!bench)
+ start = SDL_GetPerformanceCounter();
while(SDL_PollEvent(&event) != 0) {
switch(event.type) {
case SDL_QUIT:
@@ -360,8 +362,10 @@ start(Uxn *u)
evaluxn(u, mempeek16(devscreen->dat, 0));
if(reqdraw)
redraw(ppu.output, u);
- elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f;
- SDL_Delay(clamp(16.666f - elapsed, 0, 1000));
+ if(!bench){
+ elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f;
+ SDL_Delay(clamp(16.666f - elapsed, 0, 1000));
+ }
}
return 1;
}