Class: HKeyPerfDataReader::ConvertedType::PerfCounterDef

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

Constant Summary collapse

PERF_COUNTER_BASE =
0x30000
PERF_TIMER_100NS =
0x100000

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, raw_counter_def) ⇒ PerfCounterDef

Returns a new instance of PerfCounterDef.



73
74
75
76
77
78
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 73

def initialize(name, raw_counter_def)
  @name = name
  @counter_offset = raw_counter_def.counterOffset
  @counter_size = raw_counter_def.counterSize
  @counter_type = raw_counter_def.counterType
end

Instance Attribute Details

#counter_offsetObject (readonly)

Returns the value of attribute counter_offset.



65
66
67
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 65

def counter_offset
  @counter_offset
end

#counter_sizeObject (readonly)

Returns the value of attribute counter_size.



66
67
68
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 66

def counter_size
  @counter_size
end

#counter_typeObject (readonly)

Returns the value of attribute counter_type.



67
68
69
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 67

def counter_type
  @counter_type
end

#nameObject (readonly)

Returns the value of attribute name.



64
65
66
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 64

def name
  @name
end

Instance Method Details

#is_baseObject



80
81
82
83
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 80

def is_base
  # https://github.com/leoluk/perflib_exporter/blob/master/perflib/perflib.go

  is_base_counter && !is_nano_second_counter
end

#is_base_counterObject



85
86
87
88
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 85

def is_base_counter
  # https://github.com/leoluk/perflib_exporter/blob/master/perflib/perflib.go

  (@counter_type & PERF_COUNTER_BASE) == PERF_COUNTER_BASE
end

#is_nano_second_counterObject



90
91
92
93
# File 'lib/fluent/plugin/hkey_perf_data_converted_type.rb', line 90

def is_nano_second_counter
  # https://github.com/leoluk/perflib_exporter/blob/master/perflib/perflib.go

  (@counter_type & PERF_TIMER_100NS) == PERF_TIMER_100NS
end