aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/os/linux/hardware.rb
blob: 8c7f0d40185d89b5acb803246d23f014ec8d9741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module LinuxCPUs
  OPTIMIZATION_FLAGS = {}.freeze
  def optimization_flags; OPTIMIZATION_FLAGS; end

  def type
    @cpu_type ||= case `uname -m`
      when /i[3-6]86/, /x86_64/
        :intel
      else
        :dunno
      end
  end

  def family
    :dunno
  end
  alias_method :intel_family, :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