[Groonga-commit] ranguba/rroonga at 97d9830 [follow-compression-support-change] extconf: add get processor number method

Back to archive index

Hiroshi Hatake null+****@clear*****
Tue Oct 28 23:33:13 JST 2014


Hiroshi Hatake	2014-10-28 23:33:13 +0900 (Tue, 28 Oct 2014)

  New Revision: 97d9830721007c6e4c693bf7817f641ac1d5eb0f
  https://github.com/ranguba/rroonga/commit/97d9830721007c6e4c693bf7817f641ac1d5eb0f

  Message:
    extconf: add get processor number method
    
    It may build speed up. :)

  Modified files:
    ext/groonga/extconf.rb

  Modified: ext/groonga/extconf.rb (+12 -0)
===================================================================
--- ext/groonga/extconf.rb    2014-10-28 23:07:29 +0900 (0325030)
+++ ext/groonga/extconf.rb    2014-10-28 23:33:13 +0900 (143794c)
@@ -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))
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index