mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
tests: fix determining number of processors on non-macOS
This commit is contained in:
parent
133fca6093
commit
4ab5d81ce1
@ -18,13 +18,11 @@ class Controller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_num_processors
|
def get_num_processors
|
||||||
case RUBY_PLATFORM
|
np = case RUBY_PLATFORM
|
||||||
when /darwin/
|
when /darwin/ then `/usr/sbin/sysctl -n hw.availcpu`.to_i
|
||||||
np = `/usr/sbin/sysctl -n hw.availcpu`.to_i
|
else `nproc`.to_i
|
||||||
else
|
end
|
||||||
np = IO.readlines("/proc/cpuinfo").collect { |line| /^processor\s+:\s+(\d+)/.match(line) ? $1.to_i : 0 }.max + 1
|
[ np, 0 ].max + 1
|
||||||
end
|
|
||||||
return np > 0 ? np : 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def num_threads=(num)
|
def num_threads=(num)
|
||||||
|
Loading…
Reference in New Issue
Block a user