ocaml-opentelemetry/src/domain/gen.ml
2025-12-01 21:21:57 -05:00

26 lines
501 B
OCaml

let domain_4 =
{|
let cpu_relax = ignore
let relax_loop : int -> unit = ignore
|}
let domain_5 =
{|
let cpu_relax = Domain.cpu_relax
let relax_loop i =
for _j = 1 to i do cpu_relax () done
|}
let write_file file s =
let oc = open_out file in
output_string oc s;
close_out oc
let () =
let version = Scanf.sscanf Sys.ocaml_version "%d.%d.%s" (fun x y _ -> x, y) in
write_file "opentelemetry_domain.ml"
(if version >= (5, 0) then
domain_5
else
domain_4);
()