Interface PerfCounterQueryExecutor
- All Known Implementing Classes:
PerfCounterQueryExecutorJNA
public interface PerfCounterQueryExecutor
Common interface for querying Windows performance counters, abstracting JNA and FFM implementations.
Implementations perform raw queries and do not check whether counters are disabled. Callers should use
isPerfOsDisabled(), isPerfProcDisabled(), and isPerfDiskDisabled() to gate queries and
return empty results when the relevant counter category is disabled.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the disk performance counters are disabled.booleanReturns whether the OS performance counters are disabled.booleanReturns whether the process performance counters are disabled.booleanReturns whether the OS is Windows 7 or greater.queryInstancesAndValues(Class<T> propertyEnum, String perfObject, String perfWmiClass) Queries performance counter values for wildcard (multi-instance) counters.queryInstancesAndValues(Class<T> propertyEnum, String perfObject, String perfWmiClass, String customFilter) Queries performance counter values for wildcard counters with a custom instance filter.queryInstancesAndValuesFromPDH(Class<T> propertyEnum, String perfObject) Queries performance counter values from PDH only (no WMI fallback).queryInstancesAndValuesFromWMI(Class<T> propertyEnum, String perfWmiClass) Queries performance counter values from WMI directly (formatted/cooked data).<T extends Enum<T> & PdhCounterProperty>
Map<T, Long> queryValues(Class<T> propertyEnum, String perfObject, String perfWmiClass) Queries performance counter values for a fixed set of counters.
-
Method Details
-
queryValues
<T extends Enum<T> & PdhCounterProperty> Map<T,Long> queryValues(Class<T> propertyEnum, String perfObject, String perfWmiClass) Queries performance counter values for a fixed set of counters.- Type Parameters:
T- the enum type implementingPdhCounterProperty- Parameters:
propertyEnum- the property enum classperfObject- the performance object nameperfWmiClass- the WMI class name for fallback queries- Returns:
- a map of enum constants to their counter values, or an empty map if disabled
-
queryInstancesAndValues
<T extends Enum<T> & PdhCounterWildcardProperty> Pair<List<String>, Map<T, List<Long>>> queryInstancesAndValues(Class<T> propertyEnum, String perfObject, String perfWmiClass) Queries performance counter values for wildcard (multi-instance) counters.- Type Parameters:
T- the enum type implementingPdhCounterWildcardProperty- Parameters:
propertyEnum- the property enum classperfObject- the performance object nameperfWmiClass- the WMI class name for fallback queries- Returns:
- a pair of instance names and a map of enum constants to lists of values, or empty if disabled
-
queryInstancesAndValues
<T extends Enum<T> & PdhCounterWildcardProperty> Pair<List<String>, Map<T, List<Long>>> queryInstancesAndValues(Class<T> propertyEnum, String perfObject, String perfWmiClass, String customFilter) Queries performance counter values for wildcard counters with a custom instance filter.- Type Parameters:
T- the enum type implementingPdhCounterWildcardProperty- Parameters:
propertyEnum- the property enum classperfObject- the performance object nameperfWmiClass- the WMI class name for fallback queriescustomFilter- custom PDH instance filter- Returns:
- a pair of instance names and a map of enum constants to lists of values, or empty if disabled
-
queryInstancesAndValuesFromWMI
<T extends Enum<T> & PdhCounterWildcardProperty> Pair<List<String>, Map<T, List<Long>>> queryInstancesAndValuesFromWMI(Class<T> propertyEnum, String perfWmiClass) Queries performance counter values from WMI directly (formatted/cooked data).- Type Parameters:
T- the enum type implementingPdhCounterWildcardProperty- Parameters:
propertyEnum- the property enum classperfWmiClass- the WMI class name- Returns:
- a pair of instance names and a map of enum constants to lists of values, or empty if disabled
-
queryInstancesAndValuesFromPDH
<T extends Enum<T> & PdhCounterWildcardProperty> Pair<List<String>, Map<T, List<Long>>> queryInstancesAndValuesFromPDH(Class<T> propertyEnum, String perfObject) Queries performance counter values from PDH only (no WMI fallback).- Type Parameters:
T- the enum type implementingPdhCounterWildcardProperty- Parameters:
propertyEnum- the property enum classperfObject- the performance object name- Returns:
- a pair of instance names and a map of enum constants to lists of values
-
isPerfOsDisabled
boolean isPerfOsDisabled()Returns whether the OS performance counters are disabled.- Returns:
- true if PerfOS counters are disabled
-
isPerfProcDisabled
boolean isPerfProcDisabled()Returns whether the process performance counters are disabled.- Returns:
- true if PerfProc counters are disabled
-
isPerfDiskDisabled
boolean isPerfDiskDisabled()Returns whether the disk performance counters are disabled.- Returns:
- true if PerfDisk counters are disabled
-
isWin7OrGreater
boolean isWin7OrGreater()Returns whether the OS is Windows 7 or greater.- Returns:
- true if Windows 7+
-