Permalink
Please sign in to comment.
Browse files
Revert "Use Facter for CPU count"
This reverts commit e3246ed. Conflicts: lib/celluloid.rb
- Loading branch information...
Showing
with
20 additions
and 21 deletions.
- +0 −1 CHANGES.md
- +0 −1 celluloid.gemspec
- +2 −19 lib/celluloid.rb
- +18 −0 lib/celluloid/cpu_counter.rb
@@ -0,0 +1,18 @@ | ||
+require 'rbconfig' | ||
+ | ||
+module Celluloid | ||
+ module CPUCounter | ||
+ case RbConfig::CONFIG['host_os'][/^[A-Za-z]+/] | ||
+ when 'darwin' | ||
+ @cores = Integer(`sysctl hw.ncpu`[/\d+/]) | ||
+ when 'linux' | ||
+ @cores = File.read("/proc/cpuinfo").scan(/(?:core id|processor)\s+: \d+/).uniq.size | ||
+ when 'mingw', 'mswin' | ||
+ @cores = Integer(`SET NUMBER_OF_PROCESSORS`[/\d+/]) | ||
+ else | ||
+ @cores = nil | ||
+ end | ||
+ | ||
+ def self.cores; @cores; end | ||
+ end | ||
+end |
0 comments on commit
568708d