Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-10741

API monitor high CPU usage

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • None
    • None

    Description

      When API-monitor is launched, it uses 100% CPU and doesn't seem to do anything. The first dialog is only displayed after pressing a key (the alt key works), the process of loading definitions is extremely slow, but gets really fast when you move the mouse over the window. Once API monitor is loaded one Window flickers heavily, causing massive redraw, keeping the CPU at 100%. This can be "fixed" by moving the lower bounds of that window part up, so that the flickering part gets invisible, then CPU usage drops to 0.
      This is potentially 2 bugs:
      1. Excess redrawing.
      This seems to be caused by the following:

      • The app draws a listview
      • The list box sends a WM_NOTIFY to the parent window
      • The parent window moves something, causing a part of the listview to be invalidate
      • The message pump receives a WM_PAINT message and the process repeats
        BT:

         # ChildEBP RetAddr  Args to Child
        00 f6eb35f4 f7547814 00000005 f6eb37bc f6eb3774 win32k!IntInvalidateWindows+0x21 [e:\reactos\trunk\src\win32ss\user\ntuser\painting.c @ 634]
        01 f6eb3758 f7544f12 00000056 00000079 00000000 win32k!co_WinPosSetWindowPos+0xa64 [e:\reactos\trunk\src\win32ss\user\ntuser\winpos.c @ 2078]
        02 f6eb3798 8053f7fb 00020274 00000000 00000056 win32k!NtUserSetWindowPos+0x202 [e:\reactos\trunk\src\win32ss\user\ntuser\winpos.c @ 3245]
        03 f6eb37c4 8053ebfb f7544d10 0012efc8 0000001c nt!KiSystemCallTrampoline+0x1b [e:\reactos\trunk\src\ntoskrnl\include\internal\i386\ke.h @ 742]
        04 f6eb380c 80403e23 0012efe4 7c92f91e badb0d00 nt!KiSystemServiceHandler+0x24b [e:\reactos\trunk\src\ntoskrnl\ke\i386\traphdlr.c @ 1738]
        05 f6eb380c 7c92f91e 0012efe4 7c92f91e badb0d00 nt!KiFastCallEntry+0x8c
        06 0012efbc 7c5e7268 0047abae 00020274 00000000 ntdll!KiFastSystemCallRet
        07 0012efc0 0047abae 00020274 00000000 00000056 user32!NtUserSetWindowPos+0xc
        WARNING: Stack unwind information not available. Following frames may be wrong.
        08 0012efe4 0043009b 00000000 00000056 00000079 apimonitor_x86+0x7abae CWnd::SetWindowPos
        09 0012f068 00452976 01194c0c 4d010316 0000bc4e apimonitor_x86+0x3009b backtrace_2
        0a 0012f080 0047a24c 0012f5b0 0012f298 006124b8 apimonitor_x86+0x52976 backtrace_3
        0b 0012f098 0047a42c 011945d8 00000000 0000fff4 apimonitor_x86+0x7a24c _AfxDispatchCmdMsg
        0c 0012f0c8 004734dd 00000000 0000fff4 0012f0e8 apimonitor_x86+0x7a42c CCmdTarget::OnCmdMsg
        0d 0012f0f0 00470df2 0000004e 011945d8 0012f5b0 apimonitor_x86+0x734dd CWnd::ReflectChildNotify
        0e 0012f10c 00471bfc 0012f298 38fb4da8 01191dd4 apimonitor_x86+0x70df2 CWnd::SendChildNotifyLastMsg
        0f 0012f1a8 004723a1 00020268 0012f298 01191dd4 apimonitor_x86+0x71bfc CWnd::ReflectLastMsg
        10 0012f1d0 004c6f7a 011945d8 fffffff4 0012f298 apimonitor_x86+0x723a1 CWnd::OnNotify
        11 0012f1ec 00472ce5 011945d8 0012f5b0 0012f298 apimonitor_x86+0xc6f7a CMFCTabCtrl::OnNotify
        12 0012f2a8 0046e2e7 0000004e 011945d8 0012f5b0 apimonitor_x86+0x72ce5 unknown_libname_343 // MFC 3.1-11.0 32bit
        13 0012f2c8 004717e3 0000004e 011945d8 0012f5b0 apimonitor_x86+0x6e2e7 CWnd::WindowProc
        14 0012f33c 00471872 01191dd4 00020262 0000004e apimonitor_x86+0x717e3 AfxCallWndProc
        15 0012f35c 7c5d4560 00020262 0000004e 011945d8 apimonitor_x86+0x71872 AfxWndProc
        16 0012f41c 7c5d4f50 00cb73c0 00020262 0000004e user32!IntCallWindowProcW+0x430 [e:\reactos\trunk\src\win32ss\user\user32\windows\message.c @ 1502]
        17 0012f44c 7c5d0ced 00cb73c0 00020262 0000004e user32!IntCallMessageProc+0x1c0 [e:\reactos\trunk\src\win32ss\user\user32\windows\message.c @ 1742]
        18 0012f4d0 002ce8d4 00020262 0000004e 011945d8 user32!SendMessageW+0x11d [e:\reactos\trunk\src\win32ss\user\user32\windows\message.c @ 2352]
        19 0012f4ec 002cf3db 001516a8 fffffff4 0012f5b0 comctl32!notify_hdr+0x94 [e:\reactos\trunk\src\dll\win32\comctl32\listview.c @ 811]
        1a 0012f50c 002cf514 001516a8 00000002 0012f5b0 comctl32!notify_customdraw+0x9b [e:\reactos\trunk\src\dll\win32\comctl32\listview.c @ 1032]
        1b 0012f520 002d9665 001516a8 0012f5b0 0012f688 comctl32!notify_postpaint+0x14 [e:\reactos\trunk\src\dll\win32\comctl32\listview.c @ 1080]
        1c 0012f624 002e21de 001516a8 4d010316 0012f64c comctl32!LISTVIEW_Refresh+0x6a5 [e:\reactos\trunk\src\dll\win32\comctl32\listview.c @ 5248]
        1d 0012f688 002e22af 001516a8 5301012d 0012f6f4 comctl32!LISTVIEW_Paint+0x12e [e:\reactos\trunk\src\dll\win32\comctl32\listview.c @ 10697]
        1e 0012f698 002e3fd9 001516a8 00000000 0012f79c comctl32!LISTVIEW_WMPaint+0x7f [e:\reactos\trunk\src\dll\win32\comctl32\listview.c @ 10722]
        1f 0012f6f4 7c5d4560 00020268 0000000f 00000000 comctl32!LISTVIEW_WindowProc+0xe09 [e:\reactos\trunk\src\dll\win32\comctl32\listview.c @ 11735]
        20 0012f7b4 7c5cf5c7 00cb76a0 00020268 0000000f user32!IntCallWindowProcW+0x430 [e:\reactos\trunk\src\win32ss\user\user32\windows\message.c @ 1502]
        21 0012f7dc 0046e165 002e31d0 00020268 0000000f user32!CallWindowProcW+0xa7 [e:\reactos\trunk\src\win32ss\user\user32\windows\message.c @ 1816]
        22 0012f7fc 0046e2fe 0000000f 00000000 00000000 apimonitor_x86+0x6e165 CWnd::DefWindowProcW
        23 0012f818 004717e3 0000000f 00000000 00000000 apimonitor_x86+0x6e2fe CWnd::WindowProc
        24 0012f88c 00471872 011945d8 00020268 0000000f apimonitor_x86+0x717e3 AfxCallWndProc
        25 0012f8ac 7c5d4560 00020268 0000000f 00000000 apimonitor_x86+0x71872 AfxWndProc
        26 0012f96c 7c5d12fe 00cb76a0 00020268 0000000f user32!IntCallWindowProcW+0x430 [e:\reactos\trunk\src\win32ss\user\user32\windows\message.c @ 1502]
        27 0012f9f8 7c92f871 0012fa10 00000020 0012fa68 user32!User32CallWindowProcFromKernel+0x24e [e:\reactos\trunk\src\win32ss\user\user32\windows\message.c @ 2941]
        28 0012fa78 0049217e 00139930 00000000 0012fb10 ntdll!KiUserCallbackDispatcher+0x2e
        29 0012fab0 00474f75 00000004 38fb46fc 01180048 apimonitor_x86+0x9217e AfxPumpMessage
        2a 0012fafc 0042698c 38fb4708 00655cd0 ffffffff apimonitor_x86+0x74f75 CDialog::DoModal
        2b 0012fee0 00408b6d 00007f04 38fb42f0 00655cd0 apimonitor_x86+0x2698c
        2c 0012ff1c 005b265c 00000000 00000000 7ffd9000 apimonitor_x86+0x8b6d
        2d 0012ff30 0059807e 00400000 00000000 00020676 apimonitor_x86+0x1b265c
        2e 0012ffc0 7c7d4ee4 00000000 00000000 7ffd9000 apimonitor_x86+0x19807e
        2f 0012fff0 00000000 005980d1 00000000 ec0100ed KERNEL32!BaseProcessStartup+0x54 [e:\reactos\trunk\src\dll\win32\kernel32\client\proc.c @ 478]

      2. The thread/window that loads the definitions doesn't get enough runtime. This might be "normal" when the GUI thread is under heavy load, but might also be an issue itself.

      Attachments

        1. APIMon - Fixed.webm
          1.19 MB
        2. APIMon - Fixed2.webm
          1.19 MB
        3. api-monitor-07-06-2022-putty.log2lines.7z
          1.13 MB
        4. API win32kF error.png
          API win32kF error.png
          33 kB
        5. ReactOS master-2022-12-19T22-26-38-121168000Z.webm
          199 kB
        6. ReactOS master-2022-12-19T22-33-53-212544000Z.webm
          774 kB
        7. ros_api_monitor_log.txt
          379 kB
        8. ros_api_monitor.png
          ros_api_monitor.png
          105 kB
        9. snapshot57.png
          snapshot57.png
          53 kB
        10. snapshot58.png
          snapshot58.png
          100 kB
        11. snapshot59.png
          snapshot59.png
          66 kB

        Issue Links

          Activity

            People

              bug zilla Bug Zilla
              ThePhysicist Timo Kreuzer
              Votes:
              6 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: