Reputation: 411
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
Upvotes: 1
Views: 455
Reputation: 411
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:
(100 * CounterValue) / BaseValue
I love windows.
gulden
Upvotes: 2