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
    boolean addCounterToQuery​(PerfDataUtil.PerfCounter counter)
    Begin monitoring a Performance Data counter, attached to a query whose key is the counter's object.
    boolean addCounterToQuery​(PerfDataUtil.PerfCounter counter, java.lang.String key)
    Begin monitoring a Performance Data counter, attached to a query whose key is the specified string.
    long queryCounter​(PerfDataUtil.PerfCounter counter)
    Query the raw counter value of a Performance Data counter.
    void removeAllCounters()
    Stop monitoring all Performance Data counters and release their resources
    void removeAllCountersFromQuery​(java.lang.String queryKey)
    Stop monitoring Performance Data counters for a particular queryKey and release their resources
    boolean removeCounterFromQuery​(PerfDataUtil.PerfCounter counter)
    Stop monitoring a Performance Data counter, attached to a query whose key is the counter's object.
    boolean removeCounterFromQuery​(PerfDataUtil.PerfCounter counter, java.lang.String key)
    Stop monitoring a Performance Data counter, attached to a query whose key is the specified string..
    long updateQuery​(java.lang.String key)
    Update all counters on a query.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • addCounterToQuery

      public boolean addCounterToQuery​(PerfDataUtil.PerfCounter counter)
      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

      public boolean addCounterToQuery​(PerfDataUtil.PerfCounter counter, java.lang.String key)
      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

      public boolean removeCounterFromQuery​(PerfDataUtil.PerfCounter counter)
      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

      public boolean removeCounterFromQuery​(PerfDataUtil.PerfCounter counter, java.lang.String key)
      Stop 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 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

      public long queryCounter​(PerfDataUtil.PerfCounter counter)
      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