Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (20 sloc) 0.706 kb
# This helper utility launches a worker process
# for every available processor ont he current system.
#
# Author:: Jon Stacey (mailto:jon@jonsview.com)
# Copyright:: Copyright (c) 2010 Jon Stacey
# License:: Distributes under the same terms as Ruby
# Determine ruby path
ruby_path = ENV["_"]
# Determine operating system and CPU count
if RUBY_PLATFORM.downcase.include?("darwin")
cpu_count = `hwprefs cpu_count`
elsif RUBY_PLATFORM.downcase.include?("linux")
cpu_count = `cat /proc/cpuinfo | grep processor | wc -l`
end
cpu_count = Integer(cpu_count)
cpu_count.times do |i|
pid = fork { system "#{ruby_path} jprime_worker.rb" }
Process.detach(pid)
puts "Process #{i + 1} started."
end
Jump to Line
Something went wrong with that request. Please try again.