Package oshi.util.platform.windows
Class PerfCounterQueryHandler
java.lang.Object
oshi.util.platform.windows.PerfCounterQueryHandler
@ThreadSafe public final class PerfCounterQueryHandler extends java.lang.Object
Utility to handle Performance Counter Queries
-
Constructor Summary
Constructors Constructor Description PerfCounterQueryHandler() -
Method Summary
Modifier and Type Method Description booleanaddCounterToQuery(PerfDataUtil.PerfCounter counter)Begin monitoring a Performance Data counter, attached to a query whose key is the counter's object.booleanaddCounterToQuery(PerfDataUtil.PerfCounter counter, java.lang.String key)Begin monitoring a Performance Data counter, attached to a query whose key is the specified string.longqueryCounter(PerfDataUtil.PerfCounter counter)Query the raw counter value of a Performance Data counter.voidremoveAllCounters()Stop monitoring all Performance Data counters and release their resourcesvoidremoveAllCountersFromQuery(java.lang.String queryKey)Stop monitoring Performance Data counters for a particular queryKey and release their resourcesbooleanremoveCounterFromQuery(PerfDataUtil.PerfCounter counter)Stop monitoring a Performance Data counter, attached to a query whose key is the counter's object.booleanremoveCounterFromQuery(PerfDataUtil.PerfCounter counter, java.lang.String key)Stop monitoring a Performance Data counter, attached to a query whose key is the specified string..longupdateQuery(java.lang.String key)Update all counters on a query.
-
Constructor Details
-
PerfCounterQueryHandler
public PerfCounterQueryHandler()
-
-
Method Details
-
addCounterToQuery
Begin monitoring a Performance Data counter, attached to a query whose key is the counter's object.- Parameters:
counter- A PerfCounter object.- Returns:
- True if the counter was successfully added.
-
addCounterToQuery
Begin monitoring a Performance Data counter, attached to a query whose key is the specified string.- Parameters:
counter- A PerfCounter object.key- A string used as the key for the query. All counters with this key will be updated when any single counter is updated.- Returns:
- True if the counter was successfully added.
-
removeCounterFromQuery
Stop monitoring a Performance Data counter, attached to a query whose key is the counter's object.- Parameters:
counter- A PerfCounter object- Returns:
- True if the counter was successfully removed.
-
removeCounterFromQuery
Stop monitoring a Performance Data counter, attached to a query whose key is the specified string..- Parameters:
counter- A PerfCounter objectkey- A string used as the key for the query. All counters with this key will be updated when any single counter is updated.- Returns:
- True if the counter was successfully removed.
-
removeAllCountersFromQuery
public void removeAllCountersFromQuery(java.lang.String queryKey)Stop monitoring Performance Data counters for a particular queryKey and release their resources- Parameters:
queryKey- The counter object to remove counters from
-
removeAllCounters
public void removeAllCounters()Stop monitoring all Performance Data counters and release their resources -
updateQuery
public long updateQuery(java.lang.String key)Update all counters on a query.- Parameters:
key- The key of the query to update.- Returns:
- The timestamp for the update of all the counters, in milliseconds since the epoch, or 0 if the update failed
-
queryCounter
Query the raw counter value of a Performance Data counter. Further mathematical manipulation/conversion is left to the caller.- Parameters:
counter- The counter to query- Returns:
- The raw value of the counter
-