https://bugs.winehq.org/show_bug.cgi?id=45815
--- Comment #2 from jimbo1qaz jimbo1qaz@gmail.com --- Wine: 3.16 Github: https://github.com/jimbo1qaz/j0CC-FamiTracker/releases/tag/j0.6.1 Exact binary used: https://github.com/jimbo1qaz/j0CC-FamiTracker/releases/download/j0.6.1/j0CC-... Symbols: https://github.com/jimbo1qaz/j0CC-FamiTracker/releases/download/j0.6.1/j0CC-...
I ran `perf report` on native non-VM Kubuntu 18.04: - 69.22% 0x6619ba + 33.94% 0x502dc4 + 33.63% 0x503467
It seems 502dc4 and 503467 are eating CPU.
## 502dc4
`winedbg attach` immediately breaks in a subcall of 502dc4. I run bt, then compare binary addresses with x32dbg running under Wine.
- Open .exe in x32dbg - ctrl+G, paste, enter - it loads .pdb and tells me which file/line# the code corresponds to
famitrackerview.cpp:839 10 0x0000000000443e3a in j0cc-famitracker-j0.6.1 (+0x43e39) (0x000000000033fac4) void CFamiTrackerView::OnTimer(UINT_PTR nIDEvent) CView::OnTimer(nIDEvent)...
wincore.cpp 11 0x00000000004f7752 in j0cc-famitracker-j0.6.1 (+0xf7751) (0x000000000033fb90) call esi
It seems that void CFamiTrackerView::OnTimer(UINT_PTR nIDEvent) is using too much CPU time. Most of the CPU load occurs in CView::OnTimer(nIDEvent) and subfunctions (which draw the main screen).
----------
## 503467
famitracker.cpp:757 BOOL CFamiTrackerApp::OnIdle(LONG lCount) // // // if (CWinApp::OnIdle(lCount)) 7 0x00000000004196de in j0cc-famitracker-j0.6.1 (+0x196dd) (0x000000000033fe3c)
thrdcore.cpp 8 0x0000000000503467 in j0cc-famitracker-j0.6.1 (+0x103466) (0x000000000033fe5c)
It seems that BOOL CFamiTrackerApp::OnIdle(LONG lCount) is using too much CPU time. Most of the CPU load occurs in (CWinApp::OnIdle(lCount)). According to `perf report`, CWinApp::OnIdle calls GetTopWindow, GetWindow, and a deep stack leading to CallWindowProcA.
full stacktraces with partial .pdb labeling at https://gist.github.com/jimbo1qaz/58a8462e9607375b0b9948299fd266a2
Should I share the perf.data file?
------------
I suspect CFamiTrackerView::OnTimer (overrides CView::OnTimer), and CFamiTrackerApp::OnIdle (overrides CWinApp::OnIdle) are being called too often. I may have to recompile on Windows, add a print statement in both functions, and compare the rate of output in Windows vs Linux VM.
Turns out winedbg was unnecessary, the `perf report` addresses are fully valid in x32dbg. (I swear the addresses were complete gibberish last time I tried viewing in x32dbg. Maybe I viewed &stack instead of &EIP?)
------------
sidenote: running `winedbg j0CC-Famitracker-j0.6.1.exe` would crash:
WineDbg starting on pid 00c1 00c2:err:module:DelayLoadFailureHook failed to delay load uxtheme.dll.IsThemeActive wine: Call from 0x7b43d41c to unimplemented function uxtheme.dll.IsThemeActive, aborting 00c2:err:module:attach_dlls "comctl32.dll" failed to initialize, aborting 00c2:err:module:attach_dlls Initializing dlls for L"H:\apps\j0cc-famitracker\j0CC-Famitracker-j0.6.1.exe" failed, status 80000100 Process of pid=00c1 has terminated