let shards =
let shards = ref 2 in
if Sys.os_type = "Unix" then begin
if Sys.file_exists "/proc/cpuinfo" then begin
let chn_in = open_in "/proc/cpuinfo" in
let () =
try
while true do
try
let line = input_line chn_in in
Scanf.sscanf line "cpu cores : %d" (fun i -> shards := i)
with Scanf.Scan_failure _ ->
()
done
with End_of_file ->
()
in
close_in chn_in
end
end;
OUnitConf.make_int
"shards"
!shards
"Number of shards to use as worker (threads or processes)."