Task Manager shows the overall memory usage of svchost.exe. Is there a way to view the memory usage of individual services?
Note this is similar to http://serverfault.com/questions/2786/finegrain-performance-reporting-on-svchost-exe
|
Task Manager shows the overall memory usage of svchost.exe. Is there a way to view the memory usage of individual services? Note this is similar to http://serverfault.com/questions/2786/finegrain-performance-reporting-on-svchost-exe |
||||
|
|
|
There is an easy way to get the information you are asking for (but it does require a slight change to your system). I am posting my answer to a similar question, http://serverfault.com/questions/2786/ (perhaps the two questions should be merged?): Split each service to run in its own SVCHOST.EXE process and the service consuming the CPU cycles will be easily visible in Task Manager or Process Explorer (the space after "=" is required):
Do this in a command line window or put it into a BAT script. Administrative privileges are required and a restart of the computer is required before it takes effect. The original state can be restored by:
Example: to make Windows Management Instrumentation run in a separate SVCHOST.EXE:
This technique has no ill effects, except perhaps increasing memory consumption slightly. And apart from observing CPU usage for each service it also makes it easy to observe page faults delta, disk I/O read rate and disk I/O write rate for each service. For Process Explorer, menu View/Select Columns: tab Process Memory/Page Fault Delta, tab Process Performance/IO Delta Write Bytes, tab Process Performance/IO Delta Read Bytes, respectively. On most systems there is only one SVCHOST.EXE process that has a lot of services. I have used this sequence (it can be pasted directly into a command line window):
|
|||||||||||||||||
|
|
Process Explorer can show you what services are part of each Svchost.exe in, but it won't show you actual memory usage for each service. Open Process Explorer and double click on a svchost.exe, and goto the Services tab. |
|||||||||||||
|
|
You could use the built-in
Output: Image Name PID Session Name Session# Mem Usage ========================= ======== ================ =========== ============ svchost.exe 2940 Console 0 7.096 K If you don't know a name, you can list them by running this statement:
It lists all services hosted by svchost.exe, for example:
Image Name PID Services
========================= ======== ============================================
svchost.exe 632 DcomLaunch
svchost.exe 684 RpcSs
svchost.exe 748 Dhcp, Dnscache
svchost.exe 788 LmHosts, W32Time
svchost.exe 804 AeLookupSvc, AudioSrv, Browser, CryptSvc,
dmserver, EventSystem, helpsvc,
lanmanserver, lanmanworkstation, Messenger,
Netman, Nla, RasMan, Schedule, seclogon,
SENS, ShellHWDetection, TrkWks, winmgmt,
wuauserv, WZCSVC
svchost.exe 1140 ERSvc
svchost.exe 1712 RemoteRegistry
svchost.exe 196 W3SVC
svchost.exe 2940 TermService
svchost.exe 2420 TapiSrv
Services aren't necessarily hosted by |
||||
|
|
|
This is getting into stackoverflow territory, but if you can get hold of per-thread memory stats you may be able to roughly correlate that to the individual service dlls by matching them up to the dlls listed in the thread stack. Way too much for my tiny sysadmin brain, though. |
|||
|
|
|
While Process Monitor is a general purpose utility (that will do everything but wash dishes for you), for this particular question you want to use VMMap (another SysInternals utility) http://technet.microsoft.com/en-us/sysinternals/dd535533.aspx VMMap is a process virtual and physical memory analysis utility. It shows a breakdown of a process's committed virtual memory types as well as the amount of physical memory (working set) assigned by the operating system to those types. Besides graphical representations of memory usage, VMMap also shows summary information and a detailed process memory map. Powerful filtering and refresh capabilities allow you to identify the sources of process memory usage and the memory cost of application features. Besides flexible views for analyzing live processes, VMMap supports the export of data in multiple forms, including a native format that preserves all the information so that you can load back in. It also includes command-line options that enable scripting scenarios. |
|||
|
|
Process explorer will indeed show you individual memory usage within svchost Ensure you have the latest version from here http://technet.microsoft.com/en-us/sysinternals/bb896653 Make sure to run the Process Explorer as administrator, click on the svchost you want to inspect, click the Now you can view and sort on the memory usage of individual services (implemented by dlls) within the svchost. |
||||
|
|
|
Separating the services is the correct answer, but the sc config command didn't work for me (2008 R2). You can do it via the registry though, which means setting the "Type" parameter to 0x00000010 (dec. 16):
Be careful though which service you choose to modify, there are special types besides "own" and "share" that shouldn't be changed, like:
After that, just restart the service and you should see in ProcessExplorer that it now has its own svchost.exe process. |
|||
|
|