Closed dmcnaugh closed 6 years ago
Pull-request #16 reduces the CPU utilisation on my i7 running OSX to below 20%, sometimes as good as 12%. Additionally its a nice effect to lower the baudrate to 9600 and see how these machines really performed. Running WordStar or SuperCalc2 at this speed is an eye-opener.
load from my system running CP/M 2.2 idle at the prompt before applying #16 Load Avg: 1.32, 1.38, 1.30 CPU usage: 7.48% user, 10.35% sys, 82.15% id
load under same conditions after applying #16 Load Avg: 0.81, 1.11, 1.20 CPU usage: 6.84% user, 4.41% sys, 88.74% idle
Reduces %sys a bit where poll() spends most time
poll()
under OSX must be much less efficient than in your environment, but I saw a similar improvement under Debian on the Intel Atom. What OS/CPU combination are you using?
As I said in the note on the PR, its nice just to be able to play with the simulated baudrate in addition to any CPU performance benefits.
This is on OSX 10.9.5 MacBook Pro 2.4 GHz Core i5. For Debian and Ubuntu running on Core i7 CPU’s it looks similar. So never saw the problem and playing with the baud rate sure is a nice addition. There will be a small change not using timersub(), that one is not in POSIX.1 and my own time_diff() already eliminates the seconds.
On 03 Jul 2018, at 01:15, dmcnaugh notifications@github.com wrote:
poll() under OSX must be much less efficient than in your environment, but I saw a similar improvement under Debian on the Intel Atom. What OS/CPU combination are you using? As I said in the note on the PR, its nice just to be able to play with the simulated baudrate in addition to any CPU performance benefits.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Ops, doesn't work with time_diff().
Fixed, pretty good idea, thanks.
I've noticed that CPU utilisation is high even when the simulator is doing nothing but waiting on keyboard input (in running state) so I thought I'd investigate. On OSX running on an i7 its almost 50% , and on Debian on an Intel Atom its 100%, and that is when running the IMSAI machine simulation at only 2MHz. The cause appears to be triggered by the fact that CP/M busy-waits on serial I/O, and the single biggest user of this time is the
poll()
function call inimsai-sio2.c
Thepoll()
seems to be an "expensive" function with respect to CPU utilisation. And it gets called twice for each character. This high CPU utilisation isn't good for battery consumption on any of my laptops (i7 MacBook Pro, or Intel Atom Asus Netbook). I have a proposed solution that I have been using successfully that I will post as a Pull-Request.