Re: Something like "ping" for windows messages.
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Fri, 08 Dec 2006 14:40:50 -0500
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?
*****
Joseph M. Newcomer [MVP]
Cheers.
Peter.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: Something like "ping" for windows messages.
- From: Peter Smithson
- Re: Something like "ping" for windows messages.
- From: Peter Smithson
- Re: Something like "ping" for windows messages.
- References:
- Something like "ping" for windows messages.
- From: Peter Smithson
- Something like "ping" for windows messages.
- Prev by Date: Re: Main dialog window always remains behind other dialogs: how can I change this?
- Next by Date: Re: Something like "ping" for windows messages.
- Previous by thread: Re: Something like "ping" for windows messages.
- Next by thread: Re: Something like "ping" for windows messages.
- Index(es):
Relevant Pages
|
Loading