Class: OvirtMetrics::HostConfiguration

Inherits:
OvirtHistory
  • Object
show all
Defined in:
lib/ovirt_metrics/models/host_configuration.rb

Constant Summary collapse

GHZ_REGEX =
/.*\@\s*(\d+\.\d+)GHz/
MHZ_REGEX =
/.*\@\s*(\d+\.\d+)MHz/

Instance Method Summary collapse

Methods inherited from OvirtHistory

with_time_range

Instance Method Details

#speed_in_mhzObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ovirt_metrics/models/host_configuration.rb', line 9

def speed_in_mhz
  if self.cpu_model.respond_to?(:match)
    match = self.cpu_model.match(GHZ_REGEX)
    return (match[1].to_f * 1024) if match

    match = self.cpu_model.match(MHZ_REGEX)
    return match[1].to_f if match
  end

  return nil
end