Class: OvirtMetrics::VmSamplesHistory

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

Instance Method Summary collapse

Methods inherited from OvirtHistory

with_time_range

Instance Method Details

#cpu_usagemhz_rate_averageObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/ovirt_metrics/models/vm_samples_history.rb', line 6

def cpu_usagemhz_rate_average
  speed_of_host = self.host_configuration.try(:speed_in_mhz).to_f

  # TODO: Research if self.host_configuration.speed_in_mhz is aggregate or per core/socket
  # enumerator    = self.vm_configuration.cpu_per_socket * self.vm_configuration.number_of_sockets
  # vm_allocation = enumerator.to_f / self.host_configuration.number_of_cores
  # speed_of_vm   = vm_allocation * self.host_configuration.speed_in_mhz

  speed_of_host * (self.cpu_usage_percent.to_f / 100.0)
end