Lots of input messages lingering in server slowing down wine tremendously?
Saulius Krasuckas
saulius2 at ar.fi.lt
Tue Jul 8 12:17:18 CDT 2008
* On Mon, 14 Apr 2008, Alexander Dorofeyev wrote:
>
> I was able to isolate it in a very small and simplistic testcase, which
> shows this same problem. It will be included as attachment. Holding a
> key and moving mouse over the window steadily increases main loop
> latency from 10 to 50 (and even 100) in a short time, especially so if
> quickly clicking both mouse buttons as well. In a game this means going
> from 100 fps to 20 or 10 just because of input messages.
...
> Now, I do realize that what the testcase is doing is bad practice, it's
> basically refusing to process certain types of messages, and PeekMessage
> just once during a loop is probably bad as well, but that's what the
> game was originally doing in its main game loop. They do plan to fix it
> in the game. Still, there are several concerns about it:
>
> 1) No slowdown happens of Windows as far as I can tell. No matter how
> much I move the mouse holding key and clicking madly, it shows same
> stable 15-16 ticks latency in the testcase. I don't know what it does,
> but somehow it handles this situation better than Wine.
I am not minded in this area, Alexander (an am a bit away in time), but is
it algorithmically possible to convert this code to somewhat reliable test
case which wouln't depend on CPU perfomance(s) (by any chance)?
> #include <windows.h>
>
> HWND window;
>
> int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
> {
> WNDCLASS wc = {0};
> MSG msg;
> DWORD ticks, ticks2;
> HHOOK kbd_hook, mouse_hook;
>
> wc.lpfnWndProc = &DefWindowProc;
> wc.lpszClassName = "testwc";
> RegisterClass(&wc);
> window = CreateWindow("testwc", "test", WS_OVERLAPPED | WS_VISIBLE | WS_CAPTION , 0, 0, 640, 480, 0, 0, 0, 0);
>
> ticks = GetTickCount();
>
> for (;;) {
> if (PeekMessage(&msg, NULL, WM_NULL, WM_KEYFIRST, PM_REMOVE)) {
> if (msg.message == WM_QUIT) {
> DestroyWindow(window);
> break;
> }
>
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
>
> //simulated work
> ticks2 = GetTickCount();
> for (;;) {
> UINT i;
> volatile int dummy = 1;
> for (; i < 10000 && dummy; i++) ;
> if (GetTickCount() - ticks2 >= 10) break;
> }
>
> printf("main loop %u tick latency\n", GetTickCount() - ticks);
> ticks = GetTickCount();
> }
> }
More information about the wine-devel
mailing list