sys-cpu (Linux)

Last Update: Thu May 05 10:44:28 -0600 2005

Description

A Ruby interface for gathering various bits of information about your CPU.

Synopsis

   
    require "sys/cpu"
    include Sys

    CPU.processors{ |cs|
       cs.members.each{ |m|
          puts "#{m}: " + cs[m].to_s
       }
    }

    CPU.bogomips(1) # -> returns bogomips for cpu #2
   

Notes

Portions of this documentation are built dynamically, so it is incomplete on this site. You will have the full documentation when you install the package on your system.

Constants

VERSION

Returns the current version number for this package as a String.

Class Methods

CPU.load_avg

Returns an array of three floats indicating the 1, 5 and 15 minute load average.

CPU.cpu_stats

Returns a hash, with the cpu number as the key and an array as the value. The array contains the number of seconds that the system spent in user mode, user mode with low priority (nice), system mode, and the idle task, respectively, for that cpu.

CPU.processors{ |cpu struct| block }

Calls the block for each processor on your system, passing a CPUStruct as the parameter.

The exact members of the CPUStruct are the same as the class method names, except for CPU.processors (although you may optionally omit the "?" when referring to a struct member). These were determined when you installed this package because they vary from one chip architecture to another.

[Validate]