Class: HKeyPerfDataReader::ConvertedType::PerfInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/hkey_perf_data_converted_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ PerfInstance

Returns a new instance of PerfInstance.



130
131
132
133
134
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 130

def initialize(name)
  @name = name
  @counters = {}
  @counters.default = NullPerfCounter.new()
end

Instance Attribute Details

#countersObject (readonly)

Returns the value of attribute counters.



128
129
130
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 128

def counters
  @counters
end

#nameObject (readonly)

Returns the value of attribute name.



127
128
129
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 127

def name
  @name
end

Instance Method Details

#add_counter(counter_def, value) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 136

def add_counter(counter_def, value)
  unless @counters.key?(counter_def.name)
    @counters[counter_def.name] = PerfCounter.new(counter_def)
  end

  if counter_def.is_base
    @counters[counter_def.name].base_value = value
  else
    @counters[counter_def.name].value = value
  end
end