How to monitor cpu and memory usage?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

How to monitor cpu and memory usage?

Postby rado » Thu Jun 20, 2024 3:28 pm

One user is reporting occasional extreme cpu and memory usage of the application (Windows 32), probably after upgrading to newer version of application (there was also the cef upgrade) so I'm trying to find the problem.
Unfortunately I don't have access to user's computer, don't know the site and his answers takes days, also when this happens he can barely move the mouse and open the task manager. According to task manager problem seems to be in the renderer process, but it is not 100% sure.
I'm considering to implement cpu and memory usage to see which process is causing this. Is there a way to get process id of each created process in the browser process so I could call some Win32 API (maybe GetProcessMemoryInfo) regularly?
Is it possible to change the process priority ? I'd like to set it to low priority to avoid freezing of the whole desktop when the browser process goes crazy.
rado
Expert
 
Posts: 152
Joined: Wed Oct 05, 2011 3:32 am

Re: How to monitor cpu and memory usage?

Postby ndesktop » Fri Jun 21, 2024 2:51 am

Low priority will maybe affect the scheduling, but the consumption, if large, will remain.
Indeed, pages with bad javascript, huge media etc. can make renderers to take a lot of resources, but usually such a renderer will die quite quickly with OOM.
I think you need performance counters here, if you are willing to handle the (extremely ugly) PDH api, or you can use WMI, devise a query on Win32_Process on __InstanceCreationEvent and __InstanceModificationEvent, filter on DIsplayName, and register a sink using IWbemServices::ExecNotificationQueryAsync and implement IWbemObjectSink to receive events on processes to monitor.
ndesktop
Master
 
Posts: 821
Joined: Thu Dec 03, 2015 10:10 am

Re: How to monitor cpu and memory usage?

Postby rado » Fri Jun 21, 2024 9:13 am

thank you, I'll try
rado
Expert
 
Posts: 152
Joined: Wed Oct 05, 2011 3:32 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 23 guests