lib/autobuild/subcommand.rb in autobuild-1.5.51 vs lib/autobuild/subcommand.rb in autobuild-1.5.52.rc1
- old
+ new
@@ -95,10 +95,17 @@
end
@processor_count = info.inject(&:+)
else
@processor_count = processor_ids.size
end
+ else
+ result = Open3.popen3("sysctl", "-n", "hw.cpu") do |_, io, _|
+ io.read
+ end
+ if !result.empty?
+ @processor_count = Integer(result.chomp.strip)
+ end
end
# The format of the cpuinfo file is ... let's say not very standardized.
# If the cpuinfo detection fails, inform the user and set it to 1
if !@processor_count
@@ -166,16 +173,17 @@
status = File.open(logname, open_flag) do |logfile|
if Autobuild.keep_oldlogs
logfile.puts
end
- logfile.puts "#{Time.now}: running"
- logfile.puts " #{command.join(" ")}"
logfile.puts "with environment:"
ENV.keys.sort.each do |key|
logfile.puts " '#{key}'='#{ENV[key]}'"
end
+ logfile.puts
+ logfile.puts "#{Time.now}: running"
+ logfile.puts " #{command.join(" ")}"
logfile.flush
logfile.sync = true
if !input_streams.empty?
pread, pwrite = IO.pipe # to feed subprocess stdin
@@ -274,10 +282,11 @@
duration = Time.now - start_time
Autobuild.add_stat(target, phase, duration)
FileUtils.mkdir_p(Autobuild.logdir)
File.open(File.join(Autobuild.logdir, "stats.log"), 'a') do |io|
- io.puts "#{target_name} #{phase} #{duration}"
+ formatted_time = "#{start_time.strftime('%F %H:%M:%S')}.#{'%.03i' % [start_time.tv_usec / 1000]}"
+ io.puts "#{formatted_time} #{target_name} #{phase} #{duration}"
end
if target.respond_to?(:add_stat)
target.add_stat(phase, duration)
end