Why can't I see memory / cpu usage for services on windows?
In windows you can see task manager substitution or Get-Process
in powershell to get a list of running processes along with their memory and cpu usage.
You can also (on windows 8 or Get-Service
powershell) view all running services. However, for services, you don't get any of these numbers.
From my point of view as a developer, this always seemed a little odd. Of course, maintenance requires even more deployment effort and is awkward to code and debug, but otherwise it's just a program, just like any other.
I'm sure there is a good reason why services do not have these numbers, which probably have something to do with how windows start services. What is the reason?
source to share
There is a service host process "svchost.exe" that can start / process multiple services. Since resource consumption is usually measured by the operating system at the process level, services that were started by the same host process will appear as being used by that process.
If you look in the "services" area in Control Panel and find the program that starts the service, you will find that most Windows services use "svchost.exe" with different startup parameters.
The Task Manager shows multiple instances of svchost.exe, so it is possible to allocate a specific service to one instance of svchost.exe, but you need to know which instance only serves the service of interest. You can use PowerShell to start the service via svchost.exe but hang on the process id and then add a process id column in the task manager so you can see the memory / CPU usage.
source to share