Class PerfCounterQueryHandler

java.lang.Object
oshi.util.platform.windows.PerfCounterQueryHandler

public class PerfCounterQueryHandler
extends java.lang.Object
  • Method Details

    • getInstance

      public static PerfCounterQueryHandler getInstance()
      Instantiate this class as a singleton
      Returns:
      The singleton instance
    • 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