Skip to content

Commit

Permalink
Count cores properly in AWS/Ubuntu
Browse files Browse the repository at this point in the history
Since the /proc/cpuinfo file format has no standard, and ubuntu (or the version we use)
says 'processor' not 'core id'.
  • Loading branch information
jmoses committed Oct 1, 2012
1 parent cd8f976 commit a747b66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/celluloid/cpu_counter.rb
Expand Up @@ -6,7 +6,7 @@ module CPUCounter
when 'darwin'
@cores = Integer(`sysctl hw.ncpu`[/\d+/])
when 'linux'
@cores = File.read("/proc/cpuinfo").scan(/core id\s+: \d+/).uniq.size
@cores = File.read("/proc/cpuinfo").scan(/(?:core id|processor)\s+: \d+/).uniq.size
when 'mingw', 'mswin'
@cores = Integer(`SET NUMBER_OF_PROCESSORS`[/\d+/])
else
Expand Down

0 comments on commit a747b66

Please sign in to comment.