| Last Update: | Mon Mar 26 21:11:44 -0600 2007 |
A Ruby interface for gathering various bits of information about your CPU.
require "sys/cpu"
include Sys
puts "Mhz: " + CPU.cpu_freq.to_s
puts "State: " + CPU.state(0)
puts "Number of cpu's on this system: " + CPU.num_cpu.to_s
puts "Number of active cpu's: " + CPU.num_active_cpu.to_s
puts "Load averages: " + CPU.load_avg.join(", ")
VERSION
Returns the current version number for this package.
CPU.architecture
Returns the cpu architecture, e.g. PA RISC 1.2, etc.
CPU.freq(cpu_num=0)
Returns an integer indicating the speed (i.e. frequency in Mhz) of the cpu.
CPU.load_avg(cpu_num=nil)
CPU.load_avg{ |cpu| … }
In non-block form returns an array of three floats indicating the 1, 5 and 15 minute overall load average.In block form, it returns an array of three floats indicating the 1, 5 and 15 minute load average for each cpu. Only useful on multi-cpu systems.
If 'cpu_num' is provided, returns the load average (as a 3-element array) for that cpu only.
You cannot provide a cpu number and use block form at the same time.
CPU.num_cpu
Returns an integer indicating the number of cpu's on the system.
CPU.num_active_cpu
Returns an integer indicating the number of active cpu's on the system.
CPU::Error < StandardError
Raised is response to internal function errors, usually relating to an invalid cpu number.
No bugs known. Please log any bugs at http://www.rubyforge.org/projects/sysutils
Add cpu model and type
(C) 2003-2007 Daniel J. Berger
All Rights Reserved
This package is provided "as is" and without any exblockquotess or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.
Ruby's
Daniel J. Berger
djberg96 at nospam at gmail dot com
imperator on IRC (Freenode)