Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Count cores properly in AWS/Ubuntu

Since the /proc/cpuinfo file format has no standard, and ubuntu (or the version we use)
says 'processor' not 'core id'.
  • Loading branch information...
commit a747b66f258dcebd0beeeb7c3c063546222f1687 1 parent cd8f976
@jmoses authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/celluloid/cpu_counter.rb
View
2  lib/celluloid/cpu_counter.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.