
* CPU functions now exist in Hardware::CPU * Added compatibility functions in compat/hardware_compat.rb * Names are less specific to Mac hardware, e.g. CPU.family instead of Hardware.intel_family * Hardware::CPU.family works for both Intel and PowerPC * New helper methods on CPU, like .sse4? and .altivec? Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
34 lines
542 B
Ruby
34 lines
542 B
Ruby
module LinuxCPUs
|
|
OPTIMIZATION_FLAGS = {}
|
|
def optimization_flags; OPTIMIZATION_FLAGS.dup; end
|
|
|
|
def type
|
|
@cpu_type ||= case `uname -m`
|
|
when /x86_64/
|
|
:intel
|
|
when /i386/
|
|
:intel
|
|
else
|
|
:dunno
|
|
end
|
|
end
|
|
|
|
def family
|
|
:dunno
|
|
end
|
|
alias_method :intel_family, :cpu_family
|
|
|
|
def cores
|
|
`grep -c ^processor /proc/cpuinfo`.to_i
|
|
end
|
|
|
|
def bits
|
|
is_64_bit? ? 64 : 32
|
|
end
|
|
|
|
def is_64_bit?
|
|
return @is_64_bit if defined? @is_64_bit
|
|
@is_64_bit = /64/ === `uname -m`
|
|
end
|
|
end
|