Re: Something like "ping" for windows messages.



See below...
On 8 Dec 2006 02:51:06 -0800, "Peter Smithson" <Peter_Smithson@xxxxxxxxxxx> wrote:

Hi,

I'm pretty new to Windows messaging.

I want to measure how responsive my application is to messages. I
thought about doing a SetTimer(1000) and measuring how near to a 1
second interval the WM_TIMER message is processed. Then average it out
over 10 messages and log it.
****
Note that there can be a wide variation. First, you are subject to the fact that there is
a scheduler. If a higher-priority thread is running, your thread will wait, possibly for
several seconds (until the Balance Set Manager boosts its priority). Then there is the
fact that the WM_TIMER message is the second-lowest priority message; if there are any
other messages in the message queue, they take priority over WM_TIMER. You have
quantization based on the fundamental timer tick. And, of course, if you are off doing
something else in your app, the message won't be seen until your main GUI thread returns
to the message pump.

Bottom line: you'll get a WM_TIMER message when the system feels like it. It is not
deterministic, and averaging behavior over any time interval says very little about how
long the timer message will actually take.
****

Then I thought there might already be a tool that runs as an external
process and sends some standard message and measures how quick a
response is recieved. The equivalent of "ping" in network terms.
****
The response times to a SendMessage or PostMessage are completely unrelated to the
response times for WM_TIMER, so it would be the single worst possible choice for measuring
responsiveness of an app to a message.

SendMessage messages are dispatched immediately (if you have a message pump active), and
PostMessage messages are queued up. So the responsiveness to any PARTICULAR message is
going to depend solely on what your app is doing, what its current priority is relative to
all other applications and all other kernel threads, what they are doing, and so on. So
in general measuring the responsiveness to any one message is problematic in predicting
responsiveness on the average; you'd have to run not a 10-second, 10-message test, but a
several-hour, tens-to-hundreds-of-messages-per-second test. Any data from a small sample
would not be representative of reality.

There is a message WM_NULL (code 0) but it doesn't really measure much of anything,
because it simple searches through all the active message maps (oh, yes, I forgot to
include the message-map search, which depends upon what window is active and/or has the
focus) and then is handed off to DefWindowProc.
****

Is there such a thing?

Otherwise, I'll write a little app to send a message to my application.
Better that it's something external than built in to the application
(as I can re-use it and don't have to complicate the apps
configuration).
****
That would be the correct approach. However, it is not clear what you are going to learn
from it. I've got apps that are handling several hundred messages per second without
stress (we peaked at 435 messages/second, but at that point we'd saturated the network and
couldn't pump in any more network packets that were generating the messages).

What are you hoping to discover?
*****

Cheers.

Peter.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Are threads accessing the same memory space
    ... the Balance Set Manager will eventually invoke ... And if a thread has high priority, it still doesn't guarantee that the pages it touches ... responsiveness and priorities are affected by synchronization issues. ... This problem is known as the "priority inversion" problem, and is the realtime ...
    (microsoft.public.vc.mfc)
  • Re: Set default priority
    ... I understand the reason why you need low the priority of the default ... To verify the priority level, press CTRL+ALT+DELETE to open the Windows ... | set/change priority through the Windows NT Registry on my Win2k3 server. ... | processes that will require a better responsiveness with a higher ...
    (microsoft.public.win2000.advanced_server)
  • Re: which is cheapest.. RTF or HTML rich text in JEditorPane?
    ... friendliness. ... Avoiding premature optimization and making UI responsiveness your first priority are not mutually exclusive. ...
    (comp.lang.java.programmer)
  • Re: Multicores
    ... time slice intervals have only a little to do with system ... >> responsiveness. ... Give an application a higher priority and it's threads will get a longer ... slices come into play to switch between those equal priority threads. ...
    (comp.arch)

Loading