如何在Windows上为Perfmon / LogMan指定性能计数器时仅获取w3wp实例?

时间:2012-01-10 19:20:44

标签: windows configuration performancecounter perfmon

希望这个问题有一个简单的答案,我忽略了!我有一个IIS网络服务器,上面有多个网站。在Perfmon中,它们显示为w3wp#1,w3wp#2等...我正在编写一个Logman脚本,它将使用我指定的计数器/实例收集性能计数器数据,我只想收集任何w3wp工作进程

我尝试了几种方法,但没有运气:

    \.NET CLR Memory(*w3wp*)\
    \.NET CLR Memory(w3wp#*)\
    \.NET CLR Memory(w3wp*)\

我查看了文档here,似乎它声称支持通配符,但 部分匹配。我不知道该怎么做。有什么方法可以实现我想要的吗?希望我解释得这么好。如果需要更多细节,请告诉我。

谢谢!

2 个答案:

答案 0 :(得分:1)

有一种方法可以通过向其添加进程ID来显示实例。由于ProcessId不更改它有助于确定正确的实例。这篇文章描述了方法 - Perfmon: Identifying processes by PID instead of instance

链接的相关部分:

Making below registry change will display processes in the format of **ProcessName_PID** instead of **ProcessName#1**. 
Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance
On the Edit menu, click New, and then click DWORD Value.
Right-click New Value #1, click Rename, and then type ProcessNameFormat to name the new value.
Right-click ProcessNameFormat, and then click Modify.
In the Data value box, type one of the following values, and then click OK:

    1: Disables PID data. This value is the default value.
    2: Enables PID data.

Exit Registry Editor.

Warning: Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

Important: If you enable this feature, you may be unable to monitor process-specific information by using third-party utilities or custom-made programs, and this functionality may change at any time in the future without notice.

希望它有所帮助。

答案 1 :(得分:0)

我想出了一个自定义批处理脚本,它找到应用程序池ID,PID,并将其与相关的IIS工作进程相关联。从那里,我可以在我的perfmon配置文件中手动查找和替换通用占位符,以开始收集特定站点。如果有兴趣,我可以提供一些细节。