<commit_before>module Hardware
  class CPU
    class << self
      OPTIMIZATION_FLAGS_LINUX = {
        core2: "-march=core2",
        core: "-march=prescott",
        arm: "-march=armv6",
        dunno: "-march=native",
      }.freeze

      def optimization_flags
        OPTIMIZATION_FLAGS_LINUX
      end

      def universal_archs
        [].extend ArchitectureListExtension
      end

      def cpuinfo
        @cpuinfo ||= File.read("/proc/cpuinfo")
      end

      def type
        @type ||= case Utils.popen_read("uname", "-m").chomp
        when "x86_64", "amd64", /^i\d86$/
          :intel
        when /^arm/
          :arm
        else
          :dunno
        end
      end

      def family
        return :arm if arm?
        return :dunno unless intel?
        # See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers
        cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i
        cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i
        cpu_family_model = "0x" + ((cpu_family << 8) | cpu_model).to_s(16)<commit_msg>Implement CPU.universal_archs for Linuxbrew (#354)<commit_after>module Hardware
  class CPU
    class << self
      OPTIMIZATION_FLAGS_LINUX = {
        core2: "-march=core2",
        core: "-march=prescott",
        arm: "-march=armv6",
        dunno: "-march=native",
      }.freeze

      def optimization_flags
        OPTIMIZATION_FLAGS_LINUX
      end

      def universal_archs
        arch = case bits
        when 32
          arch_32_bit
        when 64
          arch_64_bit
        end
        [arch].compact.extend ArchitectureListExtension
      end

      def cpuinfo
        @cpuinfo ||= File.read("/proc/cpuinfo")
      end

      def type
        @type ||= case Utils.popen_read("uname", "-m").chomp
        when "x86_64", "amd64", /^i\d86$/
          :intel
        when /^arm/
          :arm
        else
          :dunno
        end
      end

      def family
        return :arm if arm?
        return :dunno unless intel?
        # See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers
        cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i
        cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i
        cpu_family_model = "0x" + ((cpu_family << 8) | cpu_model).to_s(16)
{'fraction_non_alphanumeric': 0.12718204488778054, 'fraction_numerical': 0.02202826267664173, 'mean_word_length': 1.8860911270983214, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4732553', 'n_tokens_mistral': 852, 'n_tokens_neox': 789, 'n_words': 161}