D4koon / WhatsappTray

Minimize Whatsapp Desktop-Client to Tray
GNU General Public License v3.0
387 stars 32 forks source link

High CPU usage #102

Open jafruts opened 2 years ago

jafruts commented 2 years ago

Hi there! I noticed sporadically high CPU usage on Whatsapptray (Up to 40%) . No clear cause or way to reproduce (waiting messages, previous messages, after system sleep/hibernate, etc).

I don't have the technical knowledge to determine if this is caused by Whatsapptray or the base Whatsapp application. And I also don't know what I can share with the forum to help diagnose the issue.

Close/restart seems to fix it for a while.

TheConfax commented 2 years ago

Same here, I get up to 30% CPU usage, are you in the beta program for usage without the phone connected @jafruts ?

D4koon commented 2 years ago

Can you post you Logfile? Maybe there is something in there that could explain that.

spersico commented 2 years ago

Can you post you Logfile? Maybe there is something in there that could explain that.

How can we post the logfile? Could you create the bug report template for the repo, with steps to take to get the report?

D4koon commented 2 years ago

The log-files are in the log-folder in your installation-folder of WhatsappTray

mlclmtan commented 2 years ago

I'm getting over 40% CPU usage with WhatsappTray, Ryzen 7 4700, log as below

20:26:57.391 - WhatsappTray::WinMain: Starting WhatsappTray 1.7.1.0 in Release CompileConfiguration. 20:26:57.391 - WhatsappTray::WinMain: CloseToTray=1. 20:26:57.393 - WhatsAppApi::Init() - Using leveldb-directory:C:\Users\q7894\AppData\Roaming\WhatsApp\IndexedDB\file__0.indexeddb.leveldb\ 20:26:57.400 - WhatsappTray::InitWhatsappTray: Prepare for starting minimized. 20:26:57.400 - TrayManager::ctor() - Creating TrayManger. 20:26:57.401 - WhatsappTray::StartWhatsapp: Starting WhatsApp from canonical-path:'C:\Users\q7894\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\WhatsApp\WhatsApp.lnk' 20:26:57.488 - WhatsappTray::StartWhatsapp: Resolved .lnk (Shortcut) to:'C:\Users\q7894\AppData\Local\WhatsApp\WhatsApp.exe' 20:26:58.112 - WhatsappTray::StartWhatsapp: WhatsApp-Window not found. Wait 500ms and retry. 20:26:58.628 - WhatsappTray::FindWhatsapp: Found window with title: 'WhatsApp' hwnd=0x00010510 20:26:58.628 - WhatsappTray::FindWhatsapp: Window is not visible 20:26:58.628 - WhatsappTray::StartWhatsapp: WhatsApp-Window not found. Wait 500ms and retry. 20:26:59.147 - WhatsappTray::FindWhatsapp: Found window with title: 'WhatsApp' hwnd=0x00010510 20:26:59.147 - WhatsappTray::FindWhatsapp: Window is not visible 20:26:59.147 - WhatsappTray::StartWhatsapp: WhatsApp-Window not found. Wait 500ms and retry. 20:26:59.660 - WhatsappTray::FindWhatsapp: Found window with title: 'WhatsApp' hwnd=0x00010510 20:26:59.660 - WhatsappTray::FindWhatsapp: Filepath is: 'C:\Users\q7894\AppData\Local\WhatsApp\app-2.2142.12\WhatsApp.exe' 20:26:59.661 - WhatsappTray::FindWhatsapp: Found match 20:26:59.661 - WhatsappTray::StartWhatsapp: WhatsApp-Window found. 20:26:59.661 - TrayManager::CreateTrayIcon(63) 20:26:59.690 - WhatsappTray::SetHook: SetHook() 20:26:59.811 - Hook> WhatsappTrayHook::Init: Attached hook.dll to ProcessID: 0x00003A2C 20:26:59.812 - Hook> WhatsappTrayHook::Init: Filepath: 'C:\Program Files (x86)\WhatsappTray\WhatsappTray.exe' WhatsappTrayLoadLibraryTest: 'TRUE' 20:26:59.812 - Hook> WhatsappTrayHook::Init: Detected that this Attache was triggered by LoadLibrary() => Cancel further processing 20:27:00.759 - Hook> WhatsappTrayHook::Init: Attached hook.dll to ProcessID: 0x00003CE0 20:27:00.760 - Hook> WhatsappTrayHook::Init: Filepath: 'C:\Users\q7894\AppData\Local\WhatsApp\app-2.2142.12\WhatsApp.exe' WhatsappTrayLoadLibraryTest: '' 20:27:00.760 - Hook> WhatsappTrayHook::Init: Attached in window 'WhatsApp' _whatsAppWindowHandle: 0x00010510 20:27:00.761 - Hook> WhatsappTrayHook::UpdateDpi: The dpi for WhatsApp is dpiX: 96 dpiY: 96 20:27:38.589 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=148 y=106 20:27:38.589 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=1772 widthOfButton=46 20:27:38.807 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=68 20:27:38.808 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=68 20:27:38.917 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=65 20:27:38.917 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=65 20:27:38.997 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=68 20:27:38.998 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=68 20:27:39.682 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=16 20:27:39.682 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=16 20:27:41.548 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=161 y=262 20:27:41.549 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=1759 widthOfButton=46 20:27:42.436 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=847 y=1008 20:27:42.437 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=1073 widthOfButton=46 20:27:42.717 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=17 20:27:42.718 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=86 20:27:42.718 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=17 20:27:42.718 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=86 20:27:43.221 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=13 20:27:43.221 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=13 20:27:44.828 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=1193 y=492 20:27:44.829 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=727 widthOfButton=46 20:27:45.141 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=27 20:27:45.141 - TrayManager::MinimizeWindowToTray(0x00010510) 20:27:45.142 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=27 22:08:47.347 - WhatsappTray::WndProc: WM_WA_CLOSE_BUTTON_PRESSED 22:08:47.347 - WhatsappTray::WndProc: Close to tray is true => Minimize WhatsApp to tray. 22:08:47.347 - TrayManager::MinimizeWindowToTray(0x00010510) 22:08:47.348 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=1890 y=7 22:08:47.348 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=30 widthOfButton=46 22:08:47.349 - Hook> WhatsappTrayHook::RedirectedWndProc: Block WM_LBUTTONUP 22:09:02.645 - WhatsappTray::WndProc: IDM_CLOSE 22:09:02.645 - TrayManager::CloseWindowFromTray() 0x00010510 22:09:02.645 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_WHATSAPPTRAY_TO_WHATSAPP_SEND_WM_CLOSE received 22:09:02.646 - Hook> WhatsappTrayHook::RedirectedWndProc: Send WM_CLOSE to WhatsApp. 22:09:02.680 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_NCDESTROY received 22:09:02.680 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_WHAHTSAPP_CLOSING successful sent. 22:09:02.698 - TrayManager::RemoveFromTray(63) 22:09:02.727 - WhatsappTray::WndProc: WM_DESTROY 22:09:02.728 - WhatsappTray::WndProc: QuitMessage posted.

jafruts commented 2 years ago

My apologies, I forgot to reply and the problem never recurred for me. I am on the beta but the problem did surface before that option appeared.

D4koon commented 2 years ago

I'm getting over 40% CPU usage with WhatsappTray, Ryzen 7 4700, log as below

20:26:57.391 - WhatsappTray::WinMain: Starting WhatsappTray 1.7.1.0 in Release CompileConfiguration. 20:26:57.391 - WhatsappTray::WinMain: CloseToTray=1. 20:26:57.393 - WhatsAppApi::Init() - Using leveldb-directory:C:\Users\q7894\AppData\Roaming\WhatsApp\IndexedDB\file__0.indexeddb.leveldb\ 20:26:57.400 - WhatsappTray::InitWhatsappTray: Prepare for starting minimized. 20:26:57.400 - TrayManager::ctor() - Creating TrayManger. 20:26:57.401 - WhatsappTray::StartWhatsapp: Starting WhatsApp from canonical-path:'C:\Users\q7894\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\WhatsApp\WhatsApp.lnk' 20:26:57.488 - WhatsappTray::StartWhatsapp: Resolved .lnk (Shortcut) to:'C:\Users\q7894\AppData\Local\WhatsApp\WhatsApp.exe' 20:26:58.112 - WhatsappTray::StartWhatsapp: WhatsApp-Window not found. Wait 500ms and retry. 20:26:58.628 - WhatsappTray::FindWhatsapp: Found window with title: 'WhatsApp' hwnd=0x00010510 20:26:58.628 - WhatsappTray::FindWhatsapp: Window is not visible 20:26:58.628 - WhatsappTray::StartWhatsapp: WhatsApp-Window not found. Wait 500ms and retry. 20:26:59.147 - WhatsappTray::FindWhatsapp: Found window with title: 'WhatsApp' hwnd=0x00010510 20:26:59.147 - WhatsappTray::FindWhatsapp: Window is not visible 20:26:59.147 - WhatsappTray::StartWhatsapp: WhatsApp-Window not found. Wait 500ms and retry. 20:26:59.660 - WhatsappTray::FindWhatsapp: Found window with title: 'WhatsApp' hwnd=0x00010510 20:26:59.660 - WhatsappTray::FindWhatsapp: Filepath is: 'C:\Users\q7894\AppData\Local\WhatsApp\app-2.2142.12\WhatsApp.exe' 20:26:59.661 - WhatsappTray::FindWhatsapp: Found match 20:26:59.661 - WhatsappTray::StartWhatsapp: WhatsApp-Window found. 20:26:59.661 - TrayManager::CreateTrayIcon(63) 20:26:59.690 - WhatsappTray::SetHook: SetHook() 20:26:59.811 - Hook> WhatsappTrayHook::Init: Attached hook.dll to ProcessID: 0x00003A2C 20:26:59.812 - Hook> WhatsappTrayHook::Init: Filepath: 'C:\Program Files (x86)\WhatsappTray\WhatsappTray.exe' WhatsappTrayLoadLibraryTest: 'TRUE' 20:26:59.812 - Hook> WhatsappTrayHook::Init: Detected that this Attache was triggered by LoadLibrary() => Cancel further processing 20:27:00.759 - Hook> WhatsappTrayHook::Init: Attached hook.dll to ProcessID: 0x00003CE0 20:27:00.760 - Hook> WhatsappTrayHook::Init: Filepath: 'C:\Users\q7894\AppData\Local\WhatsApp\app-2.2142.12\WhatsApp.exe' WhatsappTrayLoadLibraryTest: '' 20:27:00.760 - Hook> WhatsappTrayHook::Init: Attached in window 'WhatsApp' _whatsAppWindowHandle: 0x00010510 20:27:00.761 - Hook> WhatsappTrayHook::UpdateDpi: The dpi for WhatsApp is dpiX: 96 dpiY: 96 20:27:38.589 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=148 y=106 20:27:38.589 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=1772 widthOfButton=46 20:27:38.807 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=68 20:27:38.808 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=68 20:27:38.917 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=65 20:27:38.917 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=65 20:27:38.997 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=68 20:27:38.998 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=68 20:27:39.682 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=16 20:27:39.682 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=16 20:27:41.548 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=161 y=262 20:27:41.549 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=1759 widthOfButton=46 20:27:42.436 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=847 y=1008 20:27:42.437 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=1073 widthOfButton=46 20:27:42.717 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=17 20:27:42.718 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=86 20:27:42.718 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=17 20:27:42.718 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=86 20:27:43.221 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=13 20:27:43.221 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=13 20:27:44.828 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=1193 y=492 20:27:44.829 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=727 widthOfButton=46 20:27:45.141 - WhatsappTray::WndProc: WM_WA_KEY_PRESSED wParam=27 20:27:45.141 - TrayManager::MinimizeWindowToTray(0x00010510) 20:27:45.142 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_KEYUP received key=27 22:08:47.347 - WhatsappTray::WndProc: WM_WA_CLOSE_BUTTON_PRESSED 22:08:47.347 - WhatsappTray::WndProc: Close to tray is true => Minimize WhatsApp to tray. 22:08:47.347 - TrayManager::MinimizeWindowToTray(0x00010510) 22:08:47.348 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP received x=1890 y=7 22:08:47.348 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_LBUTTONUP => windowWidth=1920 xDistanceFromRight=30 widthOfButton=46 22:08:47.349 - Hook> WhatsappTrayHook::RedirectedWndProc: Block WM_LBUTTONUP 22:09:02.645 - WhatsappTray::WndProc: IDM_CLOSE 22:09:02.645 - TrayManager::CloseWindowFromTray() 0x00010510 22:09:02.645 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_WHATSAPPTRAY_TO_WHATSAPP_SEND_WM_CLOSE received 22:09:02.646 - Hook> WhatsappTrayHook::RedirectedWndProc: Send WM_CLOSE to WhatsApp. 22:09:02.680 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_NCDESTROY received 22:09:02.680 - Hook> WhatsappTrayHook::RedirectedWndProc: WM_WHAHTSAPP_CLOSING successful sent. 22:09:02.698 - TrayManager::RemoveFromTray(63) 22:09:02.727 - WhatsappTray::WndProc: WM_DESTROY 22:09:02.728 - WhatsappTray::WndProc: QuitMessage posted.

Next time please just upload the file and not that mess. Thank you. Unfortunatly i can not see the cause from the logfile. Is this something that is always happening or just in certain situations?