Message board for the users of flat assembler.
> Windows > Code that (h)eats CPU more than other code doing 'the same'
psychophanta 12 Oct 2004, 20:15
I have a very curious quest which i have decided to write and show here.
I have tried several programs (in MS Windows) in 3 different notebooks PCs (all of them above pentium III epoch, this means, all of them with a fan which is activated depending of cpu and mainboard heat detected).
NOTE: I am talking about 2D or 3D graphics, movement, under DirectX, opengl, or whatever it be.
For example, many hardware platforms emulators using windowed or full screen (MAME (with most roms being emulated), ZSNES for windows, BlueMSX, VMWARE (with MSDOS 6.22 as virtual machine), MagicENGINE (all versiones), etc.) don't seem to make cpu fan to be acelerated.
VirtualPC not tested.
But others like NLMSX, ParaMSX, etc. make cpu fan to be accelerated.
NOTE: all tests performed in a 60 m^2 room at 25 degrees, about 50% humidity.
Most compiled programs (downloaded from this forum or from sourceforge.net, etc., etc.), when using windowed or full screen always make cpu fan to be accelerated.
It seems that there are no way to to say to the final executeable that DO NOT work whenever there are nothing to do...
I've noticed that ALL the time used when the programs are WAITING FOR VSYNC to actually swap the screen buffers seems to be wasting CPU resources, what is innecessary.
I've been comparing, and the winners are mpeg players, which only use less than 10% CPU resource when playing video at full screen at 60Hz. Hardware emulators like blueMSX, ZSNES, MAME/MESS32, and some others, do it well, consuming only from 10% to 40% of CPU (I am talking about a machine I686 at 1200Mhz), but not perfect.
When using the wait functionnality of DirectX, the CPU time is 100% and the program locks on this command. For sure there is some other (clever) way to do the same while keeping a perfect synchronization, but I didn't have found it for now.
Some ways to do it consist about create multimedia timers, and use 2 or more threads. But it is not convincing.
This is an answer from Daniel Vik (main author of blueMSX emulator):
The reason why some DirectX apps use 100% cpu is actually not because of
And he added:
I think it would be possible to do an even better job. I think there are
My opinion is that without any kind of doubt the best and perfect way to do this should be to patch vsync display Interrupt Service Routine in Windows.
Is it possible to patch vsync display Interrupt Service Routine in Windows?
I mean; if the Default ISR for Vsync in Windows is:
Windows_VSYNC_ISR: code a code b ...code c... RETurn from ISR
then patch it and set up as:
Windows_VSYNC_ISR: FLIP the Screen Buffers CALL [our drawing code] code a code b ...code c... RETurn from ISR
Anyone knows something about?
|12 Oct 2004, 20:15||
comrade 12 Oct 2004, 21:54
Windows code is available...
|12 Oct 2004, 21:54||
f0dder 13 Oct 2004, 10:28
Forget about patching the ISR unless you're doing _very_ specialized stuff - people wouldn't want to install a driver to be able to run a game or multimedia app. Besides, do all video cards support the vsync irq?
|13 Oct 2004, 10:28||
psychophanta 13 Oct 2004, 20:26
Yes, you are right, but it should be the best way to do.
I have located a good text about this matter: http://www.compuphase.com/vretrace.htm
Thanks for answer.
|13 Oct 2004, 20:26||
Matrix 17 Oct 2004, 03:28
Hy, first of all, i'd like to recommend using FPU instructions in parallel with some complex CPU opcodes.
then you can think on what instructions heat more the processor,
of course it depends on architecture, an AMD may heat more on other operations than an Intel processor.
|17 Oct 2004, 03:28||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.