svchost.exe 上的细粒度性能报告

Ran*_*pho 20 windows performance-monitoring task-manager process-explorer svchost

这是我一直困扰的事情,所以我会问服务器故障社区。

我喜欢Process Explorer,它跟踪的不仅仅是您在任务管理器中获得的高级任务。但是我一直想知道在svchost下的单个进程中托管的十几个服务中的哪一个使我的处理器激增。

那么......有没有任何非侵入性的方式来找到这些信息?

Pet*_*sen 34

是的,有一种(几乎)非侵入性且简单的方法:

拆分每个服务以在其自己的 SVCHOST.EXE 进程中运行,并且消耗 CPU 周期的服务将在进程资源管理器中很容易看到(“=”后面的空格是必需的):

SC Config Servicename Type= own
Run Code Online (Sandbox Code Playgroud)

在命令行窗口中执行此操作或将其放入 BAT 脚本中。需要管理权限,并且需要重新启动计算机才能生效。

可以通过以下方式恢复原始状态:

SC Config Servicename Type= share
Run Code Online (Sandbox Code Playgroud)

示例:使 Windows Management Instrumentation 在单独的 SVCHOST.EXE 中运行:

SC Config winmgmt Type= own
Run Code Online (Sandbox Code Playgroud)

这种技术没有不良影响,只是可能会略微增加内存消耗。除了观察每个服务的 CPU 使用率之外,它还可以轻松观察每个服务的页面错误增量、磁盘 I/O 读取率和磁盘 I/O 写入率。对于进程资源管理器,菜单查看/选择列:选项卡进程内存/页面错误增量,选项卡进程性能/IO 增量写入字节,选项卡进程性能/IO 增量读取字节。


在大多数系统上,只有一个 SVCHOST.EXE 进程有很多服务。我用过这个序列(它可以直接粘贴到命令行窗口中):

rem  1. "Automatic Updates"
SC Config wuauserv Type= own

rem  2. "COM+ Event System"
SC Config EventSystem Type= own

rem  3. "Computer Browser"
SC Config Browser Type= own

rem  4. "Cryptographic Services"
SC Config CryptSvc Type= own

rem  5. "Distributed Link Tracking"
SC Config TrkWks Type= own

rem  6. "Help and Support"
SC Config helpsvc Type= own

rem  7. "Logical Disk Manager"
SC Config dmserver Type= own

rem  8. "Network Connections"
SC Config Netman Type= own

rem  9. "Network Location Awareness"
SC Config NLA Type= own

rem 10. "Remote Access Connection Manager"
SC Config RasMan Type= own

rem 11. "Secondary Logon"
SC Config seclogon Type= own

rem 12. "Server"
SC Config lanmanserver Type= own

rem 13. "Shell Hardware Detection"
SC Config ShellHWDetection Type= own

rem 14. "System Event Notification"
SC Config SENS Type= own

rem 15. "System Restore Service"
SC Config srservice Type= own

rem 16. "Task Scheduler"
SC Config Schedule Type= own

rem 17. "Telephony"
SC Config TapiSrv Type= own

rem 18. "Terminal Services"
SC Config TermService Type= own

rem 19. "Themes"
SC Config Themes Type= own

rem 20. "Windows Audio"
SC Config AudioSrv Type= own

rem 21. "Windows Firewall/Internet Connection Sharing (ICS)"
SC Config SharedAccess Type= own

rem 22. "Windows Management Instrumentation"
SC Config winmgmt Type= own

rem 23. "Wireless Configuration"
SC Config WZCSVC Type= own

rem 24. "Workstation"
SC Config lanmanworkstation Type= own

rem End.
Run Code Online (Sandbox Code Playgroud)

  • 哇,很棒的解决方案+1 (4认同)
  • 对于推荐 PowerShell 脚本的海报:我尝试过,它成功地改变了我所有的服务。但是,重新启动时会弹出一个错误框并触发重新启动。我不得不使用“最后的良好配置”进行恢复。当心。 (2认同)
  • @ChrisS 感谢您提供保持共享列表的链接!该网站现在似乎已死。根据 [Archive](https://web.archive.org/web/20120204220700/http://www.exeerrorfix.com/fix-lsass-exe-object-name-not-found),列表为:`HTTPFilter 、KDC、Netlogon、NTLMssp、PolicyAgent、ProtectedStorage、SamSs、Eventlog、PlugPlay`(都与 `lsass.exe` 相关联) (2认同)