Win32_PerfFormattedData_PerfProc_Heap python sample code
The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).
ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_PerfFormattedData_PerfProc_Heap WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Sample Code
from win32com.client import GetObject objWMI = GetObject('winmgmts:').InstancesOf('Win32_PerfFormattedData_PerfProc_Heap_Costly') for obj in objWMI: if obj.Allocs18KPersec != None: print("Allocs18KPersec:" + str(obj.Allocs18KPersec)) if obj.Allocs1KPersec != None: print("Allocs1KPersec:" + str(obj.Allocs1KPersec)) if obj.AllocsFrees != None: print("AllocsFrees:" + str(obj.AllocsFrees)) if obj.Allocsover8KPersec != None: print("Allocsover8KPersec:" + str(obj.Allocsover8KPersec)) if obj.Avgallocrate != None: print("Avgallocrate:" + str(obj.Avgallocrate)) if obj.Avgfreerate != None: print("Avgfreerate:" + str(obj.Avgfreerate)) if obj.BlocksinHeapCache != None: print("BlocksinHeapCache:" + str(obj.BlocksinHeapCache)) if obj.CachedAllocsPersec != None: print("CachedAllocsPersec:" + str(obj.CachedAllocsPersec)) if obj.CachedFreesPersec != None: print("CachedFreesPersec:" + str(obj.CachedFreesPersec)) if obj.Caption != None: print("Caption:" + str(obj.Caption)) if obj.CommittedBytes != None: print("CommittedBytes:" + str(obj.CommittedBytes)) if obj.Description != None: print("Description:" + str(obj.Description)) if obj.FreeBytes != None: print("FreeBytes:" + str(obj.FreeBytes)) if obj.FreeListLength != None: print("FreeListLength:" + str(obj.FreeListLength)) if obj.Frees18KPersec != None: print("Frees18KPersec:" + str(obj.Frees18KPersec)) if obj.Frees1KPersec != None: print("Frees1KPersec:" + str(obj.Frees1KPersec)) if obj.Freesover8KPersec != None: print("Freesover8KPersec:" + str(obj.Freesover8KPersec)) if obj.Frequency_Object != None: print("Frequency_Object:" + str(obj.Frequency_Object)) if obj.Frequency_PerfTime != None: print("Frequency_PerfTime:" + str(obj.Frequency_PerfTime)) if obj.Frequency_Sys100NS != None: print("Frequency_Sys100NS:" + str(obj.Frequency_Sys100NS)) if obj.HeapLockcontention != None: print("HeapLockcontention:" + str(obj.HeapLockcontention)) if obj.LargestCacheDepth != None: print("LargestCacheDepth:" + str(obj.LargestCacheDepth)) if obj.Name != None: print("Name:" + str(obj.Name)) if obj.PercentFragmentation != None: print("PercentFragmentation:" + str(obj.PercentFragmentation)) if obj.PercentVAFragmentation != None: print("PercentVAFragmentation:" + str(obj.PercentVAFragmentation)) if obj.ReservedBytes != None: print("ReservedBytes:" + str(obj.ReservedBytes)) if obj.Timestamp_Object != None: print("Timestamp_Object:" + str(obj.Timestamp_Object)) if obj.Timestamp_PerfTime != None: print("Timestamp_PerfTime:" + str(obj.Timestamp_PerfTime)) if obj.Timestamp_Sys100NS != None: print("Timestamp_Sys100NS:" + str(obj.Timestamp_Sys100NS)) if obj.TotalAllocsPersec != None: print("TotalAllocsPersec:" + str(obj.TotalAllocsPersec)) if obj.TotalFreesPersec != None: print("TotalFreesPersec:" + str(obj.TotalFreesPersec)) if obj.UncommittedRangesLength != None: print("UncommittedRangesLength:" + str(obj.UncommittedRangesLength)) if obj.VirtualBytes != None: print("VirtualBytes:" + str(obj.VirtualBytes)) print("") print("########") print("")