public class PerfCounterQuery<T extends Enum<T>> extends Object
PerfCounterQuery class.
Modifier and Type | Class and Description |
---|---|
static class |
PerfCounterQuery.CounterDataSource
Source of performance counter data.
|
static interface |
PerfCounterQuery.PdhCounterProperty
Contract for Counter Property Enums
|
Modifier and Type | Field and Description |
---|---|
protected com.sun.jna.platform.win32.COM.WbemcliUtil.WmiQuery<T> |
counterQuery |
static String |
NOT_TOTAL_INSTANCE
Constant
NOT_TOTAL_INSTANCE="^ + TOTAL_INSTANCE" |
static String |
NOT_TOTAL_INSTANCES
Constant
NOT_TOTAL_INSTANCES="^ + TOTAL_INSTANCES" |
protected PerfCounterQueryHandler |
pdhQueryHandler |
protected String |
perfObject |
protected String |
perfWmiClass |
protected Class<T> |
propertyEnum |
protected String |
queryKey |
protected PerfCounterQuery.CounterDataSource |
source |
static String |
TOTAL_INSTANCE
Constant
TOTAL_INSTANCE="_Total" |
static String |
TOTAL_INSTANCES
Constant
TOTAL_INSTANCES="*_Total" |
protected WmiQueryHandler |
wmiQueryHandler |
Constructor and Description |
---|
PerfCounterQuery(Class<T> propertyEnum,
String perfObject,
String perfWmiClass)
Construct a new object to hold performance counter data source and results
|
PerfCounterQuery(Class<T> propertyEnum,
String perfObject,
String perfWmiClass,
String queryKey)
Construct a new object to hold performance counter data source and results
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
initPdhCounters()
Initialize PDH counters for this data source.
|
protected void |
initWmiCounters()
Initialize the WMI query object needed to retrieve counters for this data
source.
|
Map<T,Long> |
queryValues()
Query the current data source (PDH or WMI) for the Performance Counter values
corresponding to the property enum.
|
boolean |
setDataSource(PerfCounterQuery.CounterDataSource source)
Set the Data Source for these counters
|
protected void |
unInitPdhCounters()
Uninitialize PDH counters for this data source.
|
protected void |
unInitWmiCounters()
Uninitializes the WMI query object needed to retrieve counters for this data
source, allowing it to be garbage collected.
|
protected final String perfObject
protected final String perfWmiClass
protected final String queryKey
protected PerfCounterQuery.CounterDataSource source
protected PerfCounterQueryHandler pdhQueryHandler
protected WmiQueryHandler wmiQueryHandler
protected com.sun.jna.platform.win32.COM.WbemcliUtil.WmiQuery<T extends Enum<T>> counterQuery
public static final String TOTAL_INSTANCE
TOTAL_INSTANCE="_Total"
public static final String TOTAL_INSTANCES
TOTAL_INSTANCES="*_Total"
public static final String NOT_TOTAL_INSTANCE
NOT_TOTAL_INSTANCE="^ + TOTAL_INSTANCE"
public static final String NOT_TOTAL_INSTANCES
NOT_TOTAL_INSTANCES="^ + TOTAL_INSTANCES"
public PerfCounterQuery(Class<T> propertyEnum, String perfObject, String perfWmiClass)
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 timeperfWmiClass
- The WMI PerfData_RawData_* class corresponding to the PDH objectpublic PerfCounterQuery(Class<T> propertyEnum, String perfObject, String perfWmiClass, String queryKey)
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 timeperfWmiClass
- The WMI PerfData_RawData_* class corresponding to the PDH objectqueryKey
- An optional key for PDH counter updates; defaults to the PDH
object namepublic boolean setDataSource(PerfCounterQuery.CounterDataSource source)
source
- The source of dataprotected boolean initPdhCounters()
protected void unInitPdhCounters()
protected void initWmiCounters()
protected void unInitWmiCounters()
Copyright © 2010–2020 oshi. All rights reserved.