Sha256: ec6520335a2f42b0a58b64b053812377d537eaafe2976c335a8a1476b5d9478e

Contents?: true

Size: 997 Bytes

Versions: 2

Compression:

Stored size: 997 Bytes

Contents

class Cpu
  
  @@number_of_core
  @@vendor_id
  @@cpu_count
  @@kernel_version
  @@model_name
  
  def initialize
    self.total_core
    self.cpu_information
    self.model_name
    self.cpu_count
    self.kernel_version
  end
  
  def total_core
    @@number_of_core = `/bin/grep -c ^processor /proc/cpuinfo`
  end
  
  def cpu_information
    @@vendor_id = `/bin/grep -a ^vendor /proc/cpuinfo`
    @@vendor_id.split("\n")[0].split("vendor_id")[1].split(":")[1]
  end
  
  def model_name
    @@model_name = `/bin/grep model\ name /proc/cpuinfo|sort -u|awk '{print $5" "$7 $8 $9}'`
  end
  
  def cpu_count
    @@cpu_count = `grep physical\ id /proc/cpuinfo |sort -u|wc -l`
  end
  
  def kernel_version
    @@kernel_version = `uname -rsv`
  end
  
  
  def parse
    $return_data = {
      'number_of_core' => @@number_of_core,
      'model_name' => @@model_name,
      'vendor_id' => @@vendor_id,
      'cpu_count' => @@cpu_count,
      'kernel_version' => @@kernel_version
    }

  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
miranda-0.0.3 lib/miranda/system/linux/cpu.rb
miranda-0.0.2 lib/miranda/system/linux/cpu.rb