Class PerfCounterWildcardQuery


  • @ThreadSafe
    public final class PerfCounterWildcardQuery
    extends java.lang.Object
    Enables queries of Performance Counters using wild cards to filter instances
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Set<java.lang.String> FAILED_QUERY_CACHE  
      private static org.slf4j.Logger LOG  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.lang.Enum<T>>
      Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>>
      queryInstancesAndValues​(java.lang.Class<T> propertyEnum, java.lang.String perfObject, java.lang.String perfWmiClass)
      Query the a Performance Counter using PDH, with WMI backup on failure, for values corresponding to the property enum.
      static <T extends java.lang.Enum<T>>
      Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>>
      queryInstancesAndValues​(java.lang.Class<T> propertyEnum, java.lang.String perfObject, java.lang.String perfWmiClass, java.lang.String customFilter)
      Query the a Performance Counter using PDH, with WMI backup on failure, for values corresponding to the property enum.
      static <T extends java.lang.Enum<T>>
      Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>>
      queryInstancesAndValuesFromPDH​(java.lang.Class<T> propertyEnum, java.lang.String perfObject)
      Query the a Performance Counter using PDH for values corresponding to the property enum.
      static <T extends java.lang.Enum<T>>
      Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>>
      queryInstancesAndValuesFromPDH​(java.lang.Class<T> propertyEnum, java.lang.String perfObject, java.lang.String customFilter)
      Query the a Performance Counter using PDH for values corresponding to the property enum.
      static <T extends java.lang.Enum<T>>
      Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>>
      queryInstancesAndValuesFromWMI​(java.lang.Class<T> propertyEnum, java.lang.String wmiClass)
      Query the a Performance Counter using WMI for values corresponding to the property enum.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • FAILED_QUERY_CACHE

        private static final java.util.Set<java.lang.String> FAILED_QUERY_CACHE
    • Constructor Detail

      • PerfCounterWildcardQuery

        private PerfCounterWildcardQuery()
    • Method Detail

      • queryInstancesAndValues

        public static <T extends java.lang.Enum<T>> Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>> queryInstancesAndValues​(java.lang.Class<T> propertyEnum,
                                                                                                                                                                               java.lang.String perfObject,
                                                                                                                                                                               java.lang.String perfWmiClass)
        Query the a Performance Counter using PDH, with WMI backup on failure, for values corresponding to the property enum.
        Type Parameters:
        T - The enum type of propertyEnum
        Parameters:
        propertyEnum - An enum which implements PerfCounterQuery.PdhCounterProperty and contains the WMI field (Enum value) and PDH Counter string (instance and counter)
        perfObject - The PDH object for this counter; all counters on this object will be refreshed at the same time
        perfWmiClass - The WMI PerfData_RawData_* class corresponding to the PDH object
        Returns:
        A pair containing a list of instances and an EnumMap of the corresponding values indexed by propertyEnum on success, or an empty list and empty map if both PDH and WMI queries failed.
      • queryInstancesAndValues

        public static <T extends java.lang.Enum<T>> Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>> queryInstancesAndValues​(java.lang.Class<T> propertyEnum,
                                                                                                                                                                               java.lang.String perfObject,
                                                                                                                                                                               java.lang.String perfWmiClass,
                                                                                                                                                                               java.lang.String customFilter)
        Query the a Performance Counter using PDH, with WMI backup on failure, for values corresponding to the property enum.
        Type Parameters:
        T - The enum type of propertyEnum
        Parameters:
        propertyEnum - An enum which implements PerfCounterQuery.PdhCounterProperty and contains the WMI field (Enum value) and PDH Counter string (instance and counter)
        perfObject - The PDH object for this counter; all counters on this object will be refreshed at the same time
        perfWmiClass - The WMI PerfData_RawData_* class corresponding to the PDH object
        customFilter - a custom instance filter to use. If null, uses the first element of the property enum
        Returns:
        A pair containing a list of instances and an EnumMap of the corresponding values indexed by propertyEnum on success, or an empty list and empty map if both PDH and WMI queries failed.
      • queryInstancesAndValuesFromPDH

        public static <T extends java.lang.Enum<T>> Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>> queryInstancesAndValuesFromPDH​(java.lang.Class<T> propertyEnum,
                                                                                                                                                                                      java.lang.String perfObject)
        Query the a Performance Counter using PDH for values corresponding to the property enum.
        Type Parameters:
        T - The enum type of propertyEnum
        Parameters:
        propertyEnum - An enum which implements PerfCounterQuery.PdhCounterProperty and contains the WMI field (Enum value) and PDH Counter string (instance and counter)
        perfObject - The PDH object for this counter; all counters on this object will be refreshed at the same time
        Returns:
        An pair containing a list of instances and an EnumMap of the corresponding values indexed by propertyEnum on success, or an empty list and empty map if the PDH query failed.
      • queryInstancesAndValuesFromPDH

        public static <T extends java.lang.Enum<T>> Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>> queryInstancesAndValuesFromPDH​(java.lang.Class<T> propertyEnum,
                                                                                                                                                                                      java.lang.String perfObject,
                                                                                                                                                                                      java.lang.String customFilter)
        Query the a Performance Counter using PDH for values corresponding to the property enum.
        Type Parameters:
        T - The enum type of propertyEnum
        Parameters:
        propertyEnum - An enum which implements PerfCounterQuery.PdhCounterProperty and contains the WMI field (Enum value) and PDH Counter string (instance and counter)
        perfObject - The PDH object for this counter; all counters on this object will be refreshed at the same time
        customFilter - a custom instance filter to use. If null, uses the first element of the property enum
        Returns:
        An pair containing a list of instances and an EnumMap of the corresponding values indexed by propertyEnum on success, or an empty list and empty map if the PDH query failed.
      • queryInstancesAndValuesFromWMI

        public static <T extends java.lang.Enum<T>> Pair<java.util.List<java.lang.String>,​java.util.Map<T,​java.util.List<java.lang.Long>>> queryInstancesAndValuesFromWMI​(java.lang.Class<T> propertyEnum,
                                                                                                                                                                                      java.lang.String wmiClass)
        Query the a Performance Counter using WMI for values corresponding to the property enum.
        Type Parameters:
        T - The enum type of propertyEnum
        Parameters:
        propertyEnum - An enum which implements PerfCounterQuery.PdhCounterProperty and contains the WMI field (Enum value) and PDH Counter string (instance and counter)
        wmiClass - The WMI PerfData_RawData_* class corresponding to the PDH object
        Returns:
        An pair containing a list of instances and an EnumMap of the corresponding values indexed by propertyEnum on success, or an empty list and empty map if the WMI query failed.