| Last Update: | Mon Mar 26 21:35:33 -0600 2007 |
A Ruby interface for gathering various bits of information about your CPU.
require "sys/cpu"
include Sys
# Solaris
puts "Mhz: " + CPU.cpu_freq(0).to_s
puts "State: " + CPU.state(0)
puts "Number of cpu's on this system: " + CPU.num_cpu.to_s
puts "CPU type: " + CPU.type
puts "FPU type: " + CPU.fpu_type
puts "CPU model: " + CPU.model
puts "Load averages: " + CPU.load_avg.join(", ")
VERSION
Returns the current version number for this package.
CPU.freq(cpu_num=0)
Returns an integer indicating the speed (i.e. frequency in Mhz) of 'cpu_num', or CPU 0 if no number is provided.
CPU.type
Returns a string indicating the type of processor. This is the architecture (e.g. sparcv9), not the exact model (e.g. Ultra-IIe). Returns nil if not found.
CPU.fpu_type
Returns a string indicating the type of floating point unit, or nil if not found.
CPU.load_avg
Returns an array of three floats indicating the 1, 5 and 15 minute load average.
CPU.model
Returns a string indicating the cpu model. For now, this is the architecture type, rather than the exact model. However, see the 'Future Plans' section below.
CPU.num_cpu
Returns an integer indicating the number of cpu's on the system.
CPU.state(cpu_num)
Returns a string indicating the cpu state of 'cpu_num'.
CPU::Error < StandardError
Raised is response to internal function errors, usually relating to an invalid cpu number.
None known. Please post bug reports to the SourceForge home page at http://www.rubyforge.org/projects/sysutils
Add more information, such as what prtdiag shows.
Get the model() method to display more specific information.
(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)