Module: HKeyPerfDataReader

Defined in:
lib/fluent/plugin/hkey_perf_data_reader.rb,
lib/fluent/plugin/hkey_perf_data_raw_type.rb

Overview

A reader for Windows registry key: HKeyPerfData. This provides Windows performance counter data.

ref: https://docs.microsoft.com/en-us/windows/win32/perfctrs/using-the-registry-functions-to-consume-counter-data

This provide the raw counter value, which has not been calculated according to the counter type. ref: docs.microsoft.com/en-us/dotnet/api/system.diagnostics.performancecountertype You can use this as follows:

Usage:

require_relative "hkey_perf_data_reader"
reader = HKeyPerfDataReader::Reader.new
data = reader.read
data.keys
  => ["RAS", "WSMan Quota Statistics", "Event Log", ...]
data["Memory"].instances[0].counters.keys
  => ["Page Faults/sec", "Available Bytes",  ...]
data["Memory"].instances[0].counters["Available Bytes"]
  => #<...PerfCounter... @name="Available Bytes", @value=2852536320, @base_value=0>
data["Memory"].instances[0].counters["% Committed Bytes In Use"]
  => #<...PerfCounter... @name="% Committed Bytes In Use", @value=3583260914, @base_value=4294967295>
  Note: some counters have `base_value` in separate from `value` depending on the counter type.
data["Processor"].instance_names
  => ["0", "1", "2", "3", ... , "_Total"]

Public API:

* HKeyPerfDataReader::Reader#new(object_name_whitelist: [], logger: nil)
  * object_name_whitelist
    * you can use this in order to speed up the `read` process.
    * if this is an empty list, then this reader trys to read all data.

* HKeyPerfDataReader::Reader#read()
   return hash of PerfObject

Defined Under Namespace

Modules: API, Constants, ConvertedType, RawReader, RawType Classes: BinaryParser, CounterNameTableReader, Reader