https://bugs.winehq.org/show_bug.cgi?id=47431
Bug ID: 47431 Summary: Steam and wineserver too high CPU usage Product: Wine Version: unspecified Hardware: x86 URL: https://steamcdn-a.akamaihd.net/client/installer/Steam Setup.exe OS: Linux Status: NEW Keywords: regression Severity: normal Priority: P2 Component: winex11.drv Assignee: wine-bugs@winehq.org Reporter: gyebro69@gmail.com CC: zzhang@codeweavers.com Regression SHA1: 074abfe097e31d382772aaa5fc8fdee45bbc2656 Distribution: ArchLinux
Created attachment 64778 --> https://bugs.winehq.org/attachment.cgi?id=64778 terminal output
Steam.exe and the wineserver processes consume much more cpu power than they used to, even when Steam is idling. On my rather old system equipped with a dual-core AMD processor, htop shows that Steam.exe constantly consumes 35-40% cpu power, wineserver 55-60%. This was tested with the game library page opened and while Steam was idling. Before the regression: Steam.exe: 12-15%, wineserver: 5-6 %. It's not just the Steam client that reacts more slowly to mouse input, e.g. when browsing through the list of installed games, but every game started inside Steam has a noticeable performance hit.
The commit that caused the problem:
commit 074abfe097e31d382772aaa5fc8fdee45bbc2656 Author: Zhiyi Zhang zzhang@codeweavers.com Date: Tue Jun 25 16:38:38 2019 +0800
winex11.drv: Use generic EnumDisplayMonitors.
The problem happens both in Wine's fullscreen and virtual desktop mode. I have a single monitor setup and using XFCE on Arch Linux.
wine-4.11-192-g90a1e5d943 OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GT 730/PCIe/SSE2 OpenGL core profile version string: 4.6.0 NVIDIA 418.52.10
https://bugs.winehq.org/show_bug.cgi?id=47431
--- Comment #1 from Zhiyi Zhang zzhang@codeweavers.com --- Confirmed. This is because SetupAPI functions used for the implementation is expensive. I already have a few patches to reduce part of the overhead and I will submit them soon.
https://bugs.winehq.org/show_bug.cgi?id=47431
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |4.11 CC| |focht@gmx.net Summary|Steam and wineserver too |Multiple applications and |high CPU usage |games show too high CPU | |usage and UI slowness/lag | |with | |wine-4.11-84-g074abfe097 | |(EnumDisplayMonitors | |implementation uses | |expensive registry | |accesses)
--- Comment #2 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming. It affects the performance of various apps. In one case, 'Total Commander' (https://www.ghisler.com/) it adds over 20 seconds to the startup until the main user-interface is shown. Also during runtime there is noticeable lag.
--- snip --- $ WINEDEBUG=+seh,+loaddll,+timestamp,+relay,+x11drv,+system wine64 TOTALCMD64.EXE /i="c:\totalcmd\wincmd.ini" /F="c:\totalcmd\wcx_ftp.ini"
log.txt 2>&1
... 1144.903:0071:Call user32.GetClientRect(000202de,01cca2b0) ret=00887a51 1144.903:0071:Ret user32.GetClientRect() retval=00000001 ret=00887a51 1144.903:0071:Call user32.GetPropA(000202de,0000c03c) ret=0092d25c 1144.903:0071:Ret user32.GetPropA() retval=01d1afa0 ret=0092d25c 1144.903:0071:Call user32.GetWindowPlacement(000202de,01cca118) ret=0088912f 1144.903:0071:Ret user32.GetWindowPlacement() retval=00000001 ret=0088912f 1144.903:0071:Call user32.GetWindowRect(000202de,01cca108) ret=0088917a 1144.903:0071:Ret user32.GetWindowRect() retval=00000001 ret=0088917a 1144.903:0071:Call user32.MonitorFromRect(01cc9f98,00000002) ret=0093d293 1144.903:0071:trace:system:nulldrv_EnumDisplayMonitors ((nil), (nil), 0x7f8456d7cc00, 0x1cc9d80) 1144.903:0071:Call setupapi.SetupDiGetClassDevsW(7f8456dc0f20,00000000,00000000,00000000) ret=7f8456d7eac8 1144.903:0071:Call ntdll.RtlAllocateHeap(00010000,00000000,00000030) ret=7f84546075af 1144.903:0071:Ret ntdll.RtlAllocateHeap() retval=01dd8d80 ret=7f84546075af 1144.903:0071:Call advapi32.RegCreateKeyExW(ffffffff80000002,7f845464ad80 L"System\CurrentControlSet\Enum",00000000,00000000,00000000,00020019,00000000,01cc95f0,00000000) ret=7f845460609c ... 1144.903:0071:Ret advapi32.RegCreateKeyExW() retval=00000000 ret=7f845460609c 1144.903:0071:Call advapi32.RegEnumKeyExW(000270dc,00000000,01cc9600,01cc95ec,00000000,00000000,00000000,00000000) ret=7f8454606149 ... 1144.903:0071:Ret advapi32.RegEnumKeyExW() retval=00000000 ret=7f8454606149 1144.903:0071:Call advapi32.RegOpenKeyExW(000270dc,01cc9600 L"DISPLAY",00000000,00020019,01cc95f8) ret=7f8454606173 ... 1144.904:0071:Ret advapi32.RegOpenKeyExW() retval=00000000 ret=7f8454606173 1144.904:0071:Call advapi32.RegEnumKeyExW(000270e0,00000000,01cc9170,01cc8f64,00000000,00000000,00000000,00000000) ret=7f84546054c9 ... 1144.904:0071:Call advapi32.RegCreateKeyExW(ffffffff80000002,7f845464ad80 L"System\CurrentControlSet\Enum",00000000,00000000,00000000,000f003f,00000000,01cc8d78,00000000) ret=7f8454604ea1 ... 1144.904:0071:Ret advapi32.RegCreateKeyExW() retval=00000000 ret=7f8454604ea1 1144.904:0071:Call advapi32.RegCreateKeyExW(000270f4,0011f4f0 L"DISPLAY\DEFAULT_MONITOR\0000&0000",00000000,00000000,00000000,0002001f,00000000,01cc8d80,00000000) ret=7f8454605313 ... 1144.904:0071:Call advapi32.RegSetValueExW(000270fc,7f845464af80 L"ClassGUID",00000000,00000001,01cc8d80,0000004e) ret=7f84546030b7 ... 1144.905:0071:Ret setupapi.SetupDiGetClassDevsW() retval=01dd8d80 ret=7f8456d7eac8 1144.905:0071:Call setupapi.SetupDiEnumDeviceInfo(01dd8d80,00000000,01cc9c50) ret=7f8456d7eba2 1144.905:0071:Ret setupapi.SetupDiEnumDeviceInfo() retval=00000001 ret=7f8456d7eba2 1144.905:0071:Call setupapi.SetupDiGetDevicePropertyW(01dd8d80,01cc9c50,7f8456dbf770,01cc9c20,01cc9c1c,00000004,00000000,00000000) ret=7f8456d7eb23 ... 1144.905:0071:Ret advapi32.RegQueryValueExW() retval=00000000 ret=7f84546112ee 1144.905:0071:Ret setupapi.SetupDiGetDevicePropertyW() retval=00000001 ret=7f8456d7eb66 1144.905:0071:trace:system:nulldrv_GetMonitorInfo (0x1, 0x1cc9a50) 1144.905:0071:Call setupapi.SetupDiGetClassDevsW(7f8456dc0f20,00000000,00000000,00000000) ret=7f8456d7e1fa ... 1144.908:0071:Ret setupapi.SetupDiDestroyDeviceInfoList() retval=00000001 ret=7f8456d7ebb2 1144.908:0071:trace:system:MonitorFromRect (1031,245)-(1464,265) flags 2 returning 0x1 1144.908:0071:Ret user32.MonitorFromRect() retval=00000001 ret=0093d293 ... --- snip ---
All these registry accesses hurt the app performance a lot when specific user32 API is called very often, such as 'user32.MonitorFromRect()'.
https://web.archive.org/web/20190412204700/https://totalcommander.ch/win/tcm...
$ sha1sum tcmd922ax64.exe 0434912ab8ec1ac38aa7c2d00a06ba8e5f843c8f tcmd922ax64.exe
$ du -sh tcmd922ax64.exe 5.0M tcmd922ax64.exe
$ wine-4.11-192-g90a1e5d943
Regards
https://bugs.winehq.org/show_bug.cgi?id=47431
Zhiyi Zhang zzhang@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |95be042be3f116db38eb4a255c2 | |667a6b46fcc1e Resolution|--- |FIXED
--- Comment #3 from Zhiyi Zhang zzhang@codeweavers.com --- Fixed by 95be042be3f116db38eb4a255c2667a6b46fcc1e user32: Cache monitor information.
https://bugs.winehq.org/show_bug.cgi?id=47431
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 4.12.