News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Register preservation overhead

Started by MichaelW, July 16, 2012, 05:23:27 AM

Previous topic - Next topic

MichaelW

This is in response to a misplaced debate in this topic.

Running on my wimpy 500MHz P3, with WM_MOUSEMOVE messages being sent at a rate of 1000 per second, and ensuring that the test app is in the foreground so it will get the associated priority boost, the CPU usage on the Task Manager Processes tab seldom reaches 1%. And on my 3.0GHz P4 it stays at 0%. And note that the handler does 8 rounds of preserving and restoring EBX, ESI, and EDI.
Well Microsoft, here's another nice mess you've gotten us into.

qWord

0.3% usage ... but surely not caused by that PUSH/POPs  :P
MREAL macros - when you need floating point arithmetic while assembling!

Gunther

My task manager says: ß.1% usage. Interesting point.

Gunther
You have to know the facts before you can distort them.

MichaelW

What I started out to do, and didn't have time for, was to compare the CPU usage for WM_MOUSEMOVE sent by SendMessage to that for WM_MOUSEMOVE sent by PostMessage, to get an idea of how much of the usage happens in the window procedure.
Well Microsoft, here's another nice mess you've gotten us into.

hutch--

Its pretty much the case that once you start using Windows API functions you can forget register overhead for preservation and for that matter most small algorithms. API functions are SSSSLLLLLOOOOOOWWWWWW !!!!

jj2007

Quote from: qWord on July 16, 2012, 05:46:41 AM
0.3% usage ... but surely not caused by that PUSH/POPs  :P

How did you get 0.3%? My task manager doesn't give decimals (Win7). In order to drive it above zero by manually moving the mouse, I need to insert something like this:
        CASE WM_MOUSEMOVE
mov ecx, 1000000
.Repeat
dec ecx
.Until Sign?

REPEAT 8
push ebx
...

Tested on an Athlon(tm) Dual Core Processor 4450B - the effect will be more dramatic on old CPUs.

qWord

Quote from: jj2007 on July 16, 2012, 04:48:08 PMHow did you get 0.3%? My task manager doesn't give decimals (Win7).
The Process Hacker does  this.
MREAL macros - when you need floating point arithmetic while assembling!

jj2007

Quote from: jj2007 on July 16, 2012, 04:48:08 PM
... the effect will be more dramatic on old CPUs.

Just tested it on a trusty old Celeron M. With one Million dec ecx in the WM_MOUSEMOVE handler, you need to move the mouse rather quickly to see an effect, and never above 8%...

With 5 Mio, though, you can see up to 40%  ;)

FORTRANS

Hi,

   Between 1% and 3% on my P-III with Win2k.  On my
P-MMX with Win98, it runs, but there seems no way to
report CPU usage.  Using the task manager seens to
make the system very unhappy though.  (Was trying
to see if it reported CPU usage, it does not.)

Regards,

Steve N.

jj2007

Quote from: FORTRANS on July 19, 2012, 10:12:20 PM
Between 1% and 3% on my P-III with Win2k

Hi Steve,

Is that using send.exe and test.exe together (i.e. 1,000 WM_MOUSEMOVE messages per second), or by manually moving the mouse over the window?

FORTRANS

Hi,

   That was using send.exe.  Mostly 1%, some 2%, and
a few 3%.  Figured that was what was intended.

   Wildly moving the mouse all over the place gets 1% to
9%, with more smaller numbers than large.

Regards,

Steve