Skip to content

Commit

Permalink
extconf: add get processor number method
Browse files Browse the repository at this point in the history
It may build speed up. :)
  • Loading branch information
cosmo0920 committed Oct 28, 2014
1 parent 12b7573 commit 97d9830
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ext/groonga/extconf.rb
Expand Up @@ -167,6 +167,18 @@ def configure_command_line(prefix)
escaped_command_line.join(" ")
end

def n_processors
proc_file = "/proc/cpuinfo"
use_processors = 1
if File.exist?(proc_file)
cpu_nums = `cat #{proc_file} |grep processor|wc -l`
elsif RUBY_PLATFORM =~ /darwin/
cpu_nums = `sysctl -n hw.ncpu`
end
use_processors = cpu_nums.to_i
use_processors
end

def install_for_gnu_build_system(install_dir)
run_command("configuring...",
configure_command_line(install_dir))
Expand Down

0 comments on commit 97d9830

Please sign in to comment.