VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've currently moved my entire CPU thread to the main thread (the main thread was only processing input using for(;SDL_PollEvent(&event);) loop). Now the CPU itself is also processed in the main thread (so essentially three threads now: The main(CPU&input) thread, the timer thread(handling hardware timing like the VGA etc.) and audio thread(started by SDL). There's also a pause menu thread (with the CPU thread only processing input, CPU is disabled when this thread is running) which handles the settings menu (started by pressing SELECT/Backspace at boot or during CPU running time).

For some reason the CPU is very slow now (at/below 8086 speed). It used to run at about the speed of 1MIPS according to the now-removed IPS counter (now it's about 333KIPS afaik, probably slower, not measured).

The application for some reason only runs at about 20% CPU (Idling 80% of the time). According to the profiler it spends most time in ntdll.dll or WOW64.dll. Is SDL_Delay being called too much? Or is the SDL_PollEvent the cause of the slow CPU? It's essentially one for loop every instruction executed.

My project location:
https://bitbucket.org/superfury/x86emu/src

The main file is at emu/main.c (including the CPU loop and input update calls in updateInputMain).

Last edited by superfury on 2015-09-25, 12:25. Edited 1 time in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've fixed the bug: It was locking and unlocking the CPU (using SDL sephamores) every instruction. I've changed this to once every second (since the CPU only gets locked during shutdown or initialisation during the first instruction executed normally(the build-in emulator BIOS menu)).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

Currently the CPU is running at about 0.24MIPS (0.15 on general instructions, 0.26 on the rest of the tests using MIPS v1.10 CPU Benchmark and Performance Test). Anyone knows why it's only using 20-30% of the CPU time (I'm running the emulator on a Intel Core i7-4790K@4.00GHz) with Windows 8 64-bit professional.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 3 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've managed to get it running at 0.05MIPS(General instructions), 0.10MIPS(Integer, Memory to memory, register to memory), 0.09MIPS(register to memory), performance rating 0.09MIPS. This was measured at a Intel Pentium P6100 (2.0GHz, 3MB L3 cache) running Windows 10 Home.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io