使用 WMI 获取垃圾收集器指标
我需要使用 Windows 服务器的 WMI 类收集有关 GarbageCollector 中的百分比时间的指标。我正在使用类:“Win32_PerfRawData_NETFramework_NETCLRMemory”。 这是正确的吗?
然后我为该类取了两个样本,并进行了以下计算:
# 伪代码 GC 时间百分比 = ( (样本2->'PercentTimeinGC' - 样本1->'PercentTimeinGC')/ (样本2->“TimeStamp_Sys100NS”-样本1->“TimeStamp_Sys100NS”) )
这个计算肯定是错误的,如何以正确的方式进行?
提前谢谢。
古尔登
I need to collect metrics about the Percent Time in GarbageCollector using WMI Classes for Windows servers. I'm using the Class: "Win32_PerfRawData_NETFramework_NETCLRMemory".
Is this correct?Then I take two samples for that class and i made the following calculation:
# PSEUDO CODE PercentTime in GC = ( (sample2->'PercentTimeinGC' - sample1->'PercentTimeinGC') / (sample2->'TimeStamp_Sys100NS' - sample1->'TimeStamp_Sys100NS') )
This calculation is definitively wrong, how to do it in the right way?
Tks in advance.
gulden
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在对 Windows 的未知世界进行一番挖掘之后,我找到了解决方案:
我从这个链接开始,它解释了每种指标的计算方法:
http://msdn.microsoft.com/en-us/library/ms974615.aspx
但是,我们需要知道反类型,在这种情况下是“PercentTimeinGC”的计数器类型。要知道我需要运行 WEBMTest.exe 程序:
http://technet. microsoft.com/en-us/library/cc180684.aspx
找到行:
“[DisplayName(“% GC 时间”):ToInstance、countertype(537003008):ToInstance、perfindex(2606):ToInstance、helpindex(2607): ToInstance, defaultscale(0): ToInstance, perfdetail(100): ToInstance] uint32 PercentTimeinGC;"
现在我们知道了反类型 (537003008),您需要将其映射为人类可读的形式。此链接将有所帮助:
http:// /msdn.microsoft.com/en-us/library/windows/desktop/aa389383(v=vs.85).aspx
coutertype 的映射537003008 是 PERF_RAW_FRACTION。
我们回到第一个链接,找到PERF_RAW_FRACTION的计算方法即:
I love windows。
古尔登
After some digging in the unknown world of windows I've found the solution:
I've started with this link that explains the calculation methods for each kind of metric:
http://msdn.microsoft.com/en-us/library/ms974615.aspx
However, we need to know the countertype, in this case the countertype for "PercentTimeinGC". To know that i need to run the WEBMTest.exe program:
http://technet.microsoft.com/en-us/library/cc180684.aspx
Find the line:
"[DisplayName("% Time in GC"): ToInstance, countertype(537003008): ToInstance, perfindex(2606): ToInstance, helpindex(2607): ToInstance, defaultscale(0): ToInstance, perfdetail(100): ToInstance] uint32 PercentTimeinGC;"
Now that we know the countertype (537003008), you need to map it to a human readable form. This link will help:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa389383(v=vs.85).aspx
The mapping for coutertype 537003008 is PERF_RAW_FRACTION.
We go back for the first link and find the calculation method for PERF_RAW_FRACTION that is:
I love windows.
gulden