Detect number of CPUs installed

前端 未结 12 943
孤城傲影
孤城傲影 2020-12-24 05:29

I already found a solution for \"Most unixes\" via cat /proc/cpuinfo, but a pure-Ruby solution would be nicer.

12条回答
  •  猫巷女王i
    2020-12-24 06:16

    @grosser:

    when /linux/  
      `grep -c processor /proc/cpuinfo`.to_i
    

    http://www.partmaps.org/era/unix/award.html#cat
    http://www.partmaps.org/era/unix/award.html#wc

提交回复
热议问题