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