diff --git a/src/bin_snoop/commands.ml b/src/bin_snoop/commands.ml index 6806d8a95501cc58f1069d1774f56f26b1d8c2ae..de6d446c64d2388007ec424f1cfa2e4ca730606c 100644 --- a/src/bin_snoop/commands.ml +++ b/src/bin_snoop/commands.ml @@ -1412,6 +1412,7 @@ module Display_info_cmd = struct let pp_fancy_benchmark fmt (module B : Benchmark.S) = bold_block fmt "Name" Namespace.pp B.name ; + bold_block fmt "Filename" Format.pp_print_string B.module_filename ; bold_block fmt "Info" Format.pp_print_string B.info ; bold_block fmt "Tags" pp_tags B.tags ; bold_block fmt "Models" (pp_models ()) B.models diff --git a/src/lib_benchmark/benchmark.ml b/src/lib_benchmark/benchmark.ml index ea0443e0ee3654058bc1f527fd2d4af794e9bfed..35f7bdac195615b40c085f88c2349f3992d20cff 100644 --- a/src/lib_benchmark/benchmark.ml +++ b/src/lib_benchmark/benchmark.ml @@ -34,6 +34,9 @@ module type S = sig (** Description of the benchmark *) val info : string + (** File where the benchmark module is defined *) + val module_filename : string + (** Tags of the benchmark *) val tags : string list diff --git a/src/lib_benchmark/builtin_benchmarks.ml b/src/lib_benchmark/builtin_benchmarks.ml index 3031c81d6bba0931ef1209a7b295312bbaf92a84..7e9a11cfb93dafd5a761b260f434965cacafa147 100644 --- a/src/lib_benchmark/builtin_benchmarks.ml +++ b/src/lib_benchmark/builtin_benchmarks.ml @@ -40,6 +40,8 @@ module Timer_latency_bench : Benchmark.S = struct let info = "Measuring timer latency" + let module_filename = __FILE__ + let tags = ["misc"; "builtin"] let models = [("*", Model.(make ~conv:(fun () -> ()) ~model:Model.zero))] diff --git a/src/lib_benchmark/example/blake2b.ml b/src/lib_benchmark/example/blake2b.ml index 935dd531ea873066753e2b4a0921fae8e173bd55..af1d77d6c884174895ff30c4d5ac194db68ef2fd 100644 --- a/src/lib_benchmark/example/blake2b.ml +++ b/src/lib_benchmark/example/blake2b.ml @@ -48,6 +48,8 @@ module Blake2b_bench : Benchmark.S = struct let info = "Illustrating tezos-benchmark by benchmarking blake2b" + let module_filename = __FILE__ + let tags = ["example"] (* We will measure hashing time on random bytes with length diff --git a/src/lib_benchmark/test/test_probe.ml b/src/lib_benchmark/test/test_probe.ml index dc903bc7ef32951e25e4856343941592c0385632..80b4bb6650e0a9b268be6589001603548c910deb 100644 --- a/src/lib_benchmark/test/test_probe.ml +++ b/src/lib_benchmark/test/test_probe.ml @@ -57,6 +57,8 @@ module Probing_bench = struct let default_config = {max_bytes = 1 lsl 16} + let module_filename = __FILE__ + (* The encoding is used by `tezos-snoop` to load the config from json files. *) let config_encoding = diff --git a/src/lib_shell_benchmarks/bloomer_benchmarks.ml b/src/lib_shell_benchmarks/bloomer_benchmarks.ml index 2929e5ad69d7113f7aa7fbe870e6cbacd95ce906..7d84c1f2069ee5f734b06b9dc49e72c766d37304 100644 --- a/src/lib_shell_benchmarks/bloomer_benchmarks.ml +++ b/src/lib_shell_benchmarks/bloomer_benchmarks.ml @@ -42,6 +42,8 @@ let make_bench ~name ~info ~model ~generator ~make_bench : let default_config = () + let module_filename = __FILE__ + let config_encoding = Data_encoding.unit type workload = unit diff --git a/src/lib_shell_benchmarks/encoding_benchmarks.ml b/src/lib_shell_benchmarks/encoding_benchmarks.ml index 10cb4d3ab57246bab5e826b60107b2930338efcd..8666f696c3419c5c58e0997944ffb3c5fb5026ab 100644 --- a/src/lib_shell_benchmarks/encoding_benchmarks.ml +++ b/src/lib_shell_benchmarks/encoding_benchmarks.ml @@ -24,8 +24,10 @@ (* *) (*****************************************************************************) open Benchmarks_shell -open Encoding_benchmarks_helpers +open Encoding_benchmarks_helpers.Make (struct + let file = __FILE__ +end) (* ------------------------------------------------------------------------- *) module Make_elliptic_curve_encoding_benchmarks (A : sig diff --git a/src/lib_shell_benchmarks/encoding_benchmarks_helpers.ml b/src/lib_shell_benchmarks/encoding_benchmarks_helpers.ml index 14dcea8aae6cbe7d784b88b59d15ab24de6e7515..a0f74edd7ce4ff24ad8ae8fce4dcf72a3902b259 100644 --- a/src/lib_shell_benchmarks/encoding_benchmarks_helpers.ml +++ b/src/lib_shell_benchmarks/encoding_benchmarks_helpers.ml @@ -59,286 +59,299 @@ module Shared_linear = struct Sparse_vec.String.of_list [("bytes", float_of_int bytes)] end -(* Generic function to cook benchmarks for fixed-size encodings *) -let fixed_size_shared : - ?check:(unit -> unit) -> - name:string -> - generator:'a Base_samplers.sampler -> - make_bench: - ((unit -> 'a) -> unit -> unit Tezos_benchmark.Generator.benchmark) -> - unit -> - Tezos_benchmark.Benchmark.t = - fun ?(check = fun () -> ()) ~name ~generator ~make_bench () -> - let free_variable = fv (Format.asprintf "%s_const" name) in - let model = - Model.make - ~conv:(fun () -> ()) - ~model:(Model.unknown_const1 ~name:(ns name) ~const:free_variable) - in - let module Bench : Benchmark.S = struct - let name = ns name - - let info = Format.asprintf "Benchmarking %a" Namespace.pp name - - let tags = ["encoding"] - - include Shared_constant_time - - let create_benchmarks ~rng_state ~bench_num () = - check () ; - let generator () = generator rng_state in - List.repeat bench_num (make_bench generator) - - let models = [("encoding", model)] - end in - ((module Bench) : Benchmark.t) - -(* Generic function to cook benchmarks for linear-time encodings *) -let linear_shared ?(check = fun () -> ()) ~name ~generator ~make_bench () = - let const = fv (Format.asprintf "%s_const" name) in - let coeff = fv (Format.asprintf "%s_coeff" name) in - let model = - Model.make - ~conv:(fun {Shared_linear.bytes} -> (bytes, ())) - ~model:(Model.affine ~name:(ns name) ~intercept:const ~coeff) - in - let module Bench : Benchmark.S = struct - let name = ns name - - let info = Format.asprintf "Benchmarking %a" Namespace.pp name - - let tags = ["encoding"] - - include Shared_linear - - let create_benchmarks ~rng_state ~bench_num () = - check () ; - let generator () = generator rng_state in - List.repeat bench_num (make_bench generator) - - let models = [("encoding", model)] - end in - ((module Bench) : Benchmark.t) - -(* Generic function to cook benchmarks for nlogn-time encodings *) -let nsqrtn_shared_with_intercept ~name ~generator ~make_bench - ~generator_intercept ~make_bench_intercept = - let const = fv (Format.asprintf "%s_const" name) in - let coeff = fv (Format.asprintf "%s_coeff" name) in - let model = - Model.make - ~conv:(fun {Shared_linear.bytes} -> (bytes, ())) - ~model:(Model.nsqrtn_const ~name:(ns name) ~intercept:const ~coeff) - in - let module Bench : Benchmark.S = struct - let name = ns name - - let info = Format.asprintf "Benchmarking %a" Namespace.pp name - - let tags = ["encoding"] - - include Shared_linear - - let create_benchmarks ~rng_state ~bench_num () = - let generator () = generator rng_state in - List.repeat bench_num (make_bench generator) - - let models = [("encoding", model)] - end in - let module Bench_intercept : Benchmark.S = struct - let name = (Namespace.make ns name) "intercept" - - let info = - Format.asprintf "Benchmarking %a (intercept case)" Namespace.pp name - - let tags = ["encoding"] - - include Shared_linear - - let create_benchmarks ~rng_state ~bench_num () = - let generator () = generator_intercept rng_state in - List.repeat bench_num (make_bench_intercept generator) - - let models = [("encoding", model)] - end in - (((module Bench) : Benchmark.t), ((module Bench_intercept) : Benchmark.t)) - -let make_encode_fixed_size : - type a. - ?check:(unit -> unit) -> - name:string -> - encoding:a Data_encoding.t -> - generator:(Random.State.t -> a) -> - unit -> - Benchmark.t = - fun ?check ~name ~encoding ~generator () -> - fixed_size_shared - ?check - ~name - ~generator - ~make_bench:(fun generator () -> - let generated = generator () in - let closure () = - ignore (Data_encoding.Binary.to_bytes_exn encoding generated) - in - Generator.Plain {workload = (); closure}) - () - -let make_encode_variable_size : - type a. - ?check:(unit -> unit) -> - name:string -> - encoding:a Data_encoding.t -> - generator:(Random.State.t -> a * Shared_linear.workload) -> - unit -> - Benchmark.t = - fun ?check ~name ~encoding ~generator -> - linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated, workload = generator () in - let closure () = - ignore (Data_encoding.Binary.to_bytes_exn encoding generated) - in - Generator.Plain {workload; closure}) - -let make_decode_fixed_size : - type a. - ?check:(unit -> unit) -> - name:string -> - encoding:a Data_encoding.t -> - generator:(Random.State.t -> a) -> - unit -> - Benchmark.t = - fun ?check ~name ~encoding ~generator -> - fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated = generator () in - let encoded = Data_encoding.Binary.to_bytes_exn encoding generated in - let closure () = - ignore (Data_encoding.Binary.of_bytes_exn encoding encoded) - in - Generator.Plain {workload = (); closure}) - -let make_decode_variable_size : - type a. - ?check:(unit -> unit) -> - name:string -> - encoding:a Data_encoding.t -> - generator:(Random.State.t -> a * Shared_linear.workload) -> - unit -> - Benchmark.t = - fun ?check ~name ~encoding ~generator -> - linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated, workload = generator () in - let encoded = Data_encoding.Binary.to_bytes_exn encoding generated in - let closure () = - ignore (Data_encoding.Binary.of_bytes_exn encoding encoded) - in - Generator.Plain {workload; closure}) - -(* Generic functions to cook benchmarks for b58check conversions (used for - typechecking in readable mode in the protocol...) and byte conversions. *) -let make_encode_fixed_size_to_string : - type a. - ?check:(unit -> unit) -> - name:string -> - to_string:(a -> string) -> - generator:(Random.State.t -> a) -> - unit -> - Benchmark.t = - fun ?check ~name ~to_string ~generator -> - fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated = generator () in - let closure () = ignore (to_string generated) in - Generator.Plain {workload = (); closure}) - -(* Exactly the sample implem' as above.*) -let make_encode_fixed_size_to_bytes : - type a. - ?check:(unit -> unit) -> - name:string -> - to_bytes:(a -> bytes) -> - generator:(Random.State.t -> a) -> - unit -> - Benchmark.t = - fun ?check ~name ~to_bytes ~generator -> - fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated = generator () in - let closure () = ignore (to_bytes generated) in - Generator.Plain {workload = (); closure}) - -let make_encode_variable_size_to_string : - type a. - ?check:(unit -> unit) -> - name:string -> - to_string:(a -> string) -> - generator:(Random.State.t -> a * Shared_linear.workload) -> - unit -> - Benchmark.t = - fun ?check ~name ~to_string ~generator -> - linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated, workload = generator () in - let closure () = ignore (to_string generated) in - Generator.Plain {workload; closure}) - -let make_decode_fixed_size_from_string : - type a. - ?check:(unit -> unit) -> - name:string -> - to_string:(a -> string) -> - from_string:(string -> a) -> - generator:(Random.State.t -> a) -> - unit -> - Benchmark.t = - fun ?check ~name ~to_string ~from_string ~generator -> - fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated = generator () in - let string = to_string generated in - let closure () = ignore (from_string string) in - Generator.Plain {workload = (); closure}) - -let make_decode_fixed_size_from_bytes : - type a. - ?check:(unit -> unit) -> - name:string -> - to_bytes:(a -> bytes) -> - from_bytes:(bytes -> a) -> - generator:(Random.State.t -> a) -> - unit -> - Benchmark.t = - fun ?check ~name ~to_bytes ~from_bytes ~generator -> - fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated = generator () in - let bytes = to_bytes generated in - let closure () = ignore (from_bytes bytes) in - Generator.Plain {workload = (); closure}) - -let make_decode_variable_size_from_string : - type a. - ?check:(unit -> unit) -> - name:string -> - to_string:(a -> string) -> - from_string:(string -> a) -> - generator:(Random.State.t -> a * Shared_linear.workload) -> - unit -> - Benchmark.t = - fun ?check ~name ~to_string ~from_string ~generator -> - linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated, workload = generator () in - let string = to_string generated in - let closure () = ignore (from_string string) in - Generator.Plain {workload; closure}) - -let make_decode_variable_size_from_bytes : - type a. - ?check:(unit -> unit) -> - name:string -> - to_bytes:(a -> bytes) -> - from_bytes:(bytes -> a) -> - generator:(Random.State.t -> a * Shared_linear.workload) -> - unit -> - Benchmark.t = - fun ?check ~name ~to_bytes ~from_bytes ~generator -> - linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> - let generated, workload = generator () in - let string = to_bytes generated in - let closure () = ignore (from_bytes string) in - Generator.Plain {workload; closure}) +module Make (Filename : sig + val file : string +end) = +struct + (* Generic function to cook benchmarks for fixed-size encodings *) + let fixed_size_shared : + ?check:(unit -> unit) -> + name:string -> + generator:'a Base_samplers.sampler -> + make_bench: + ((unit -> 'a) -> unit -> unit Tezos_benchmark.Generator.benchmark) -> + unit -> + Tezos_benchmark.Benchmark.t = + fun ?(check = fun () -> ()) ~name ~generator ~make_bench () -> + let free_variable = fv (Format.asprintf "%s_const" name) in + let model = + Model.make + ~conv:(fun () -> ()) + ~model:(Model.unknown_const1 ~name:(ns name) ~const:free_variable) + in + let module Bench : Benchmark.S = struct + let name = ns name + + let info = Format.asprintf "Benchmarking %a" Namespace.pp name + + let module_filename = Filename.file + + let tags = ["encoding"] + + include Shared_constant_time + + let create_benchmarks ~rng_state ~bench_num () = + check () ; + let generator () = generator rng_state in + List.repeat bench_num (make_bench generator) + + let models = [("encoding", model)] + end in + ((module Bench) : Benchmark.t) + + (* Generic function to cook benchmarks for linear-time encodings *) + let linear_shared ?(check = fun () -> ()) ~name ~generator ~make_bench () = + let const = fv (Format.asprintf "%s_const" name) in + let coeff = fv (Format.asprintf "%s_coeff" name) in + let model = + Model.make + ~conv:(fun {Shared_linear.bytes} -> (bytes, ())) + ~model:(Model.affine ~name:(ns name) ~intercept:const ~coeff) + in + let module Bench : Benchmark.S = struct + let name = ns name + + let info = Format.asprintf "Benchmarking %a" Namespace.pp name + + let module_filename = Filename.file + + let tags = ["encoding"] + + include Shared_linear + + let create_benchmarks ~rng_state ~bench_num () = + check () ; + let generator () = generator rng_state in + List.repeat bench_num (make_bench generator) + + let models = [("encoding", model)] + end in + ((module Bench) : Benchmark.t) + + (* Generic function to cook benchmarks for nlogn-time encodings *) + let nsqrtn_shared_with_intercept ~name ~generator ~make_bench + ~generator_intercept ~make_bench_intercept = + let const = fv (Format.asprintf "%s_const" name) in + let coeff = fv (Format.asprintf "%s_coeff" name) in + let model = + Model.make + ~conv:(fun {Shared_linear.bytes} -> (bytes, ())) + ~model:(Model.nsqrtn_const ~name:(ns name) ~intercept:const ~coeff) + in + let module Bench : Benchmark.S = struct + let name = ns name + + let info = Format.asprintf "Benchmarking %a" Namespace.pp name + + let module_filename = Filename.file + + let tags = ["encoding"] + + include Shared_linear + + let create_benchmarks ~rng_state ~bench_num () = + let generator () = generator rng_state in + List.repeat bench_num (make_bench generator) + + let models = [("encoding", model)] + end in + let module Bench_intercept : Benchmark.S = struct + let name = (Namespace.make ns name) "intercept" + + let info = + Format.asprintf "Benchmarking %a (intercept case)" Namespace.pp name + + let module_filename = Filename.file + + let tags = ["encoding"] + + include Shared_linear + + let create_benchmarks ~rng_state ~bench_num () = + let generator () = generator_intercept rng_state in + List.repeat bench_num (make_bench_intercept generator) + + let models = [("encoding", model)] + end in + (((module Bench) : Benchmark.t), ((module Bench_intercept) : Benchmark.t)) + + let make_encode_fixed_size : + type a. + ?check:(unit -> unit) -> + name:string -> + encoding:a Data_encoding.t -> + generator:(Random.State.t -> a) -> + unit -> + Benchmark.t = + fun ?check ~name ~encoding ~generator () -> + fixed_size_shared + ?check + ~name + ~generator + ~make_bench:(fun generator () -> + let generated = generator () in + let closure () = + ignore (Data_encoding.Binary.to_bytes_exn encoding generated) + in + Generator.Plain {workload = (); closure}) + () + + let make_encode_variable_size : + type a. + ?check:(unit -> unit) -> + name:string -> + encoding:a Data_encoding.t -> + generator:(Random.State.t -> a * Shared_linear.workload) -> + unit -> + Benchmark.t = + fun ?check ~name ~encoding ~generator -> + linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated, workload = generator () in + let closure () = + ignore (Data_encoding.Binary.to_bytes_exn encoding generated) + in + Generator.Plain {workload; closure}) + + let make_decode_fixed_size : + type a. + ?check:(unit -> unit) -> + name:string -> + encoding:a Data_encoding.t -> + generator:(Random.State.t -> a) -> + unit -> + Benchmark.t = + fun ?check ~name ~encoding ~generator -> + fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated = generator () in + let encoded = Data_encoding.Binary.to_bytes_exn encoding generated in + let closure () = + ignore (Data_encoding.Binary.of_bytes_exn encoding encoded) + in + Generator.Plain {workload = (); closure}) + + let make_decode_variable_size : + type a. + ?check:(unit -> unit) -> + name:string -> + encoding:a Data_encoding.t -> + generator:(Random.State.t -> a * Shared_linear.workload) -> + unit -> + Benchmark.t = + fun ?check ~name ~encoding ~generator -> + linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated, workload = generator () in + let encoded = Data_encoding.Binary.to_bytes_exn encoding generated in + let closure () = + ignore (Data_encoding.Binary.of_bytes_exn encoding encoded) + in + Generator.Plain {workload; closure}) + + (* Generic functions to cook benchmarks for b58check conversions (used for + typechecking in readable mode in the protocol...) and byte conversions. *) + let make_encode_fixed_size_to_string : + type a. + ?check:(unit -> unit) -> + name:string -> + to_string:(a -> string) -> + generator:(Random.State.t -> a) -> + unit -> + Benchmark.t = + fun ?check ~name ~to_string ~generator -> + fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated = generator () in + let closure () = ignore (to_string generated) in + Generator.Plain {workload = (); closure}) + + (* Exactly the sample implem' as above.*) + let make_encode_fixed_size_to_bytes : + type a. + ?check:(unit -> unit) -> + name:string -> + to_bytes:(a -> bytes) -> + generator:(Random.State.t -> a) -> + unit -> + Benchmark.t = + fun ?check ~name ~to_bytes ~generator -> + fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated = generator () in + let closure () = ignore (to_bytes generated) in + Generator.Plain {workload = (); closure}) + + let make_encode_variable_size_to_string : + type a. + ?check:(unit -> unit) -> + name:string -> + to_string:(a -> string) -> + generator:(Random.State.t -> a * Shared_linear.workload) -> + unit -> + Benchmark.t = + fun ?check ~name ~to_string ~generator -> + linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated, workload = generator () in + let closure () = ignore (to_string generated) in + Generator.Plain {workload; closure}) + + let make_decode_fixed_size_from_string : + type a. + ?check:(unit -> unit) -> + name:string -> + to_string:(a -> string) -> + from_string:(string -> a) -> + generator:(Random.State.t -> a) -> + unit -> + Benchmark.t = + fun ?check ~name ~to_string ~from_string ~generator -> + fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated = generator () in + let string = to_string generated in + let closure () = ignore (from_string string) in + Generator.Plain {workload = (); closure}) + + let make_decode_fixed_size_from_bytes : + type a. + ?check:(unit -> unit) -> + name:string -> + to_bytes:(a -> bytes) -> + from_bytes:(bytes -> a) -> + generator:(Random.State.t -> a) -> + unit -> + Benchmark.t = + fun ?check ~name ~to_bytes ~from_bytes ~generator -> + fixed_size_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated = generator () in + let bytes = to_bytes generated in + let closure () = ignore (from_bytes bytes) in + Generator.Plain {workload = (); closure}) + + let make_decode_variable_size_from_string : + type a. + ?check:(unit -> unit) -> + name:string -> + to_string:(a -> string) -> + from_string:(string -> a) -> + generator:(Random.State.t -> a * Shared_linear.workload) -> + unit -> + Benchmark.t = + fun ?check ~name ~to_string ~from_string ~generator -> + linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated, workload = generator () in + let string = to_string generated in + let closure () = ignore (from_string string) in + Generator.Plain {workload; closure}) + + let make_decode_variable_size_from_bytes : + type a. + ?check:(unit -> unit) -> + name:string -> + to_bytes:(a -> bytes) -> + from_bytes:(bytes -> a) -> + generator:(Random.State.t -> a * Shared_linear.workload) -> + unit -> + Benchmark.t = + fun ?check ~name ~to_bytes ~from_bytes ~generator -> + linear_shared ?check ~name ~generator ~make_bench:(fun generator () -> + let generated, workload = generator () in + let string = to_bytes generated in + let closure () = ignore (from_bytes string) in + Generator.Plain {workload; closure}) +end diff --git a/src/lib_shell_benchmarks/io_benchmarks.ml b/src/lib_shell_benchmarks/io_benchmarks.ml index aabd9c799d0ee4b4825e620e35c5ded5bf14807e..d6af812df54253de3a6379c76b3e98db4f0c5c24 100644 --- a/src/lib_shell_benchmarks/io_benchmarks.ml +++ b/src/lib_shell_benchmarks/io_benchmarks.ml @@ -266,6 +266,8 @@ module Context_size_dependent_read_bench : Benchmark.S = struct let tags = ["io"] + let module_filename = __FILE__ + include Context_size_dependent_shared let make_bench rng_state cfg () = @@ -351,6 +353,8 @@ module Context_size_dependent_write_bench : Benchmark.S = struct "Benchmarking the write accesses with contexts of various sizes (with \ fixed storage size except for the written key)" + let module_filename = __FILE__ + let tags = ["io"] let write_storage context key bytes = @@ -569,6 +573,8 @@ module Irmin_pack_read_bench : Benchmark.S = struct let info = "Benchmarking read accesses in irmin-pack directories" + let module_filename = __FILE__ + let tags = ["io"] type workload = @@ -734,6 +740,8 @@ module Irmin_pack_write_bench : Benchmark.S = struct let info = "Benchmarking write accesses in irmin-pack directories" + let module_filename = __FILE__ + let tags = ["io"] type workload = @@ -894,6 +902,8 @@ module Read_random_key_bench : Benchmark.S = struct let info = "Benchmarking random read accesses in a subdirectory" + let module_filename = __FILE__ + let tags = ["io"] type workload = Read_random_key of {depth : int; storage_bytes : int} @@ -1037,6 +1047,8 @@ module Write_random_keys_bench : Benchmark.S = struct let info = "Benchmarking random read accesses in a subdirectory" + let module_filename = __FILE__ + let tags = ["io"] type workload = diff --git a/src/lib_shell_benchmarks/micheline_benchmarks.ml b/src/lib_shell_benchmarks/micheline_benchmarks.ml index 4ea66a230cc5dfbdcdb5c7c1d07ca8cad8a21783..facc69a42af315bd830b15dab2afa661ef96a0f3 100644 --- a/src/lib_shell_benchmarks/micheline_benchmarks.ml +++ b/src/lib_shell_benchmarks/micheline_benchmarks.ml @@ -133,6 +133,8 @@ module Micheline_strip_locations : Benchmark.S = struct let info = "Benchmarking Micheline.strip_locations" + let module_filename = __FILE__ + let tags = ["micheline"] type config = unit diff --git a/src/lib_shell_benchmarks/misc_benchmarks.ml b/src/lib_shell_benchmarks/misc_benchmarks.ml index 79c9165e438fbe6bfdfe9e428ca9079ac7ef3c1c..92db44d0ee13d2cdd4650f4af695c2a5f1f64758 100644 --- a/src/lib_shell_benchmarks/misc_benchmarks.ml +++ b/src/lib_shell_benchmarks/misc_benchmarks.ml @@ -46,6 +46,8 @@ module Lwt_main_run_bench : Benchmark.S = struct let info = "Benchmark of Lwt_main.run" + let module_filename = __FILE__ + let tags = ["misc"] let models = [("*", lwt_model)] diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/cache_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/cache_benchmarks.ml index 73acf4329bcd18171a80a06ecf32c2d4cbfeb01f..91c580f09c19beb5fddec052109ea3d810db35e6 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/cache_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/cache_benchmarks.ml @@ -131,6 +131,8 @@ module Cache_update_benchmark : Benchmark.S = struct let info = "Benchmarking the time it takes to update a key in the cache" + let module_filename = __FILE__ + (** It is expected that cache keys are non-adversarial, ie do not share a long common prefix. This is the case for [Script_cache], for which the keys are B58-encoded contract hashes. diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/carbonated_map_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/carbonated_map_benchmarks.ml index 3864e6c17a48ac026bafe47bb9a610da517361b4..8caf846bb0eccad4519c00f2d9fce065631bc7a9 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/carbonated_map_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/carbonated_map_benchmarks.ml @@ -81,6 +81,8 @@ module Fold_benchmark : Benchmark.S = struct let info = "Carbonated map to list" + let module_filename = __FILE__ + let fold_model = Model.make ~conv:(fun {size} -> (size, ())) @@ -169,6 +171,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated map compare cost for %s keys" CS.type_name + let module_filename = __FILE__ + let models = [ ( "carbonated_map", @@ -209,6 +213,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated find model" + let module_filename = __FILE__ + (** Given the cost of comparing keys, the model is used for deducing [intercept] and [traverse_overhead] from: @@ -312,6 +318,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated find model (intercept case)" + let module_filename = __FILE__ + let models = [ ( "carbonated_map", diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/encodings_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/encodings_benchmarks.ml index 0e81ca18d78875890bd104ed0de60f644a3cfb81..fd8dcb25963b8685644e51c598fe17eeaaa5ba21 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/encodings_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/encodings_benchmarks.ml @@ -135,6 +135,8 @@ module Encoding_micheline : Benchmark.S = struct let info = "Benchmarking strip_location + encoding of Micheline to bytes" + let module_filename = __FILE__ + let micheline_serialization_trace (micheline_node : Alpha_context.Script.node) = match @@ -203,6 +205,8 @@ module Decoding_micheline : Benchmark.S = struct let info = "Decoding of bytes to Micheline" + let module_filename = __FILE__ + let micheline_deserialization_trace (micheline_str : string) = match Data_encoding.Binary.of_string @@ -267,27 +271,31 @@ end let () = Registration_helpers.register (module Decoding_micheline) +module Encodings = +Tezos_shell_benchmarks.Encoding_benchmarks_helpers.Make (struct + let file = __FILE__ +end) + module Timestamp = struct let () = Registration_helpers.register - @@ - let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in - fixed_size_shared - ~name:"TIMESTAMP_READABLE_ENCODING" - ~generator:(fun rng_state -> - let seconds_in_year = 30_000_000 in - let offset = Random.State.int rng_state seconds_in_year in - Script_timestamp.of_zint (Z.of_int (1597764116 + offset))) - ~make_bench:(fun generator () -> - let tstamp_string = generator () in - let closure () = ignore (Script_timestamp.to_notation tstamp_string) in - Generator.Plain {workload = (); closure}) - () + @@ Encodings.fixed_size_shared + ~name:"TIMESTAMP_READABLE_ENCODING" + ~generator:(fun rng_state -> + let seconds_in_year = 30_000_000 in + let offset = Random.State.int rng_state seconds_in_year in + Script_timestamp.of_zint (Z.of_int (1597764116 + offset))) + ~make_bench:(fun generator () -> + let tstamp_string = generator () in + let closure () = + ignore (Script_timestamp.to_notation tstamp_string) + in + Generator.Plain {workload = (); closure}) + () let () = let b, b_intercept = - let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in - nsqrtn_shared_with_intercept + Encodings.nsqrtn_shared_with_intercept ~name:"TIMESTAMP_READABLE_DECODING" ~generator:(fun rng_state -> let offset = @@ -322,8 +330,6 @@ end https://gitlab.com/dannywillems/ocaml-bls12-381/-/blob/71d0b4d467fbfaa6452d702fcc408d7a70916a80/README.md#install *) module BLS = struct - open Tezos_shell_benchmarks.Encoding_benchmarks_helpers - let check () = if not Bls12_381.built_with_blst_portable then ( Format.eprintf @@ -334,7 +340,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_bytes + @@ Encodings.make_encode_fixed_size_to_bytes ~check ~name:"ENCODING_BLS_FR" ~to_bytes:Bls12_381.Fr.to_bytes @@ -343,7 +349,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_bytes + @@ Encodings.make_encode_fixed_size_to_bytes ~check ~name:"ENCODING_BLS_G1" ~to_bytes:Bls12_381.G1.to_bytes @@ -352,7 +358,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_bytes + @@ Encodings.make_encode_fixed_size_to_bytes ~check ~name:"ENCODING_BLS_G2" ~to_bytes:Bls12_381.G2.to_bytes @@ -361,7 +367,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~check ~name:"DECODING_BLS_FR" ~to_bytes:Bls12_381.Fr.to_bytes @@ -371,7 +377,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~check ~name:"DECODING_BLS_G1" ~to_bytes:Bls12_381.G1.to_bytes @@ -381,7 +387,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~check ~name:"DECODING_BLS_G2" ~to_bytes:Bls12_381.G2.to_bytes @@ -391,7 +397,7 @@ module BLS = struct let () = Registration_helpers.register - @@ fixed_size_shared + @@ Encodings.fixed_size_shared ~check ~name:"BLS_FR_FROM_Z" ~generator:(fun rng_state -> Bls12_381.Fr.random ~state:rng_state ()) @@ -404,7 +410,7 @@ module BLS = struct let () = Registration_helpers.register - @@ fixed_size_shared + @@ Encodings.fixed_size_shared ~check ~name:"BLS_FR_TO_Z" ~generator:(fun rng_state -> Bls12_381.Fr.random ~state:rng_state ()) @@ -416,8 +422,6 @@ module BLS = struct end module Timelock = struct - open Tezos_shell_benchmarks.Encoding_benchmarks_helpers - let generator rng_state = let log_time = Base_samplers.sample_in_interval ~range:{min = 0; max = 29} rng_state @@ -433,7 +437,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_encode_variable_size_to_string + @@ Encodings.make_encode_variable_size_to_string ~name:"ENCODING_Chest" ~to_string: (Data_encoding.Binary.to_string_exn @@ -445,7 +449,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_string + @@ Encodings.make_encode_fixed_size_to_string ~name:"ENCODING_Chest_key" ~to_string: (Data_encoding.Binary.to_string_exn @@ -457,7 +461,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_decode_variable_size_from_bytes + @@ Encodings.make_decode_variable_size_from_bytes ~name:"DECODING_Chest" ~to_bytes: (Data_encoding.Binary.to_bytes_exn @@ -477,7 +481,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~name:"DECODING_Chest_key" ~to_bytes: (Data_encoding.Binary.to_bytes_exn diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/global_constants_storage_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/global_constants_storage_benchmarks.ml index 20b9fbdbb860be64ec3a9c853cf55f7e415fee96..9410f13e0a6d310cb4f89c32caaaa44a7743915b 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/global_constants_storage_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/global_constants_storage_benchmarks.ml @@ -294,6 +294,8 @@ module Set_add : Benchmark.S = struct let info = "Benchmarks and cost model for set element addition from OCaml stdlib." + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -348,6 +350,8 @@ module Set_elements : Benchmark.S = struct let info = "Benchmarks and cost model for set elements from OCaml stdlib." + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -405,6 +409,8 @@ module Script_expr_hash_of_b58check_opt : Benchmark.S = struct let info = "Benchmark for Script_expr_hash.of_b58check_opt" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -475,6 +481,8 @@ struct Global_constants_storage.Internal_for_tests.expr_to_address_in_context \ function" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -559,6 +567,8 @@ module Global_constants_storage_expand_models = struct "Benchmark for the constant branch Global_constants_storage.expand \ function" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -635,6 +645,8 @@ module Global_constants_storage_expand_models = struct "Benchmark for the Global_constants_storage.expand function on the case \ without constants" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml index 2757ec3b52b63e53dfda3e00e4c5ab4aa17c4817..1931e0462959532d21dfd1ebe445c2ad33098a6a 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -256,6 +256,8 @@ let make_benchmark : let tags = tags @ more_tags + let module_filename = __FILE__ + let models = (* [intercept = true] implies there's a benchmark with [intercept = false]. No need to register the model twice. *) @@ -541,6 +543,8 @@ let make_continuation_benchmark : include Default_config include Default_boilerplate + let module_filename = __FILE__ + let tags = tags @ more_tags let models = @@ -651,6 +655,8 @@ module Registration_section = struct let info = "Benchmarking the cost of an empty loop" + let module_filename = __FILE__ + let tags = [Tags.interpreter] type config = {max_iterations : int} @@ -2541,6 +2547,8 @@ module Registration_section = struct let info = info + let module_filename = __FILE__ + include Default_config include Default_boilerplate diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/sapling_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/sapling_benchmarks.ml index e0bcdf21536d9509cbcfcda363707d2cd7241fca..767e5861b88a6a5b74b533b9dfbdb60922adb905 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/sapling_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/sapling_benchmarks.ml @@ -36,6 +36,8 @@ module Apply_diff_bench : Benchmark.S = struct let info = "Benchmarking SAPLING_APPLY_DIFF" + let module_filename = __FILE__ + let tags = ["sapling"] let diff_from_tx (tx : Alpha_context.Sapling.transaction) = diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml index 6b31573630f9123eb2637ce739d3efdb3a518851..c769e534932f5dcea05825e73f20546b2ec68094 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml @@ -41,6 +41,8 @@ module Sc_rollup_update_num_and_size_of_messages_benchmark = struct "Estimating the cost of updating the number and total size of messages \ when adding a message to a sc_rollup inbox" + let module_filename = __FILE__ + let tags = ["scoru"] type config = { @@ -143,6 +145,8 @@ module Sc_rollup_add_external_messages_benchmark = struct let info = "Estimating the costs of adding a single message to a rollup inbox" + let module_filename = __FILE__ + let tags = ["scoru"] type config = {max_length : int; max_level : int} diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_repr_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_repr_benchmarks.ml index 3c8493c028ec61e781052e3f1522c6db3a3c6ef7..a68744913e2df12b35cbea0aeaa3e32b9cafd906 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_repr_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_repr_benchmarks.ml @@ -78,6 +78,8 @@ module Micheline_nodes_benchmark : Benchmark.S = struct "Benchmarking the time it takes to compute the number of nodes of a \ Micheline term" + let module_filename = __FILE__ + let size_based_model = Model.make ~conv:(function {micheline_nodes} -> (micheline_nodes, ())) @@ -117,6 +119,8 @@ module Script_repr_strip_annotations : Benchmark.S = struct let info = "Benchmarking Script_repr.strip_annotations" + let module_filename = __FILE__ + let strip_annotations_model = Model.( make diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml index cc436c9406998c3e85a673ce8dfafe416c61853d..5199ed85e7654a770983e2137d90b61e555037fd 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml @@ -79,6 +79,8 @@ end = struct let info = "Benchmarking Script_typed_ir_size.value_size" + let module_filename = __FILE__ + let value_size_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Script_repr.expr) = (* FIXME: cleanup and factorize this code between translator benches and these ones. *) @@ -152,6 +154,8 @@ module Type_size_benchmark : Tezos_benchmark.Benchmark.S = struct let info = "Benchmarking the time it takes to compute Script_typed_ir_size.ty_size" + let module_filename = __FILE__ + let models = [(model_name, size_based_model name)] let type_size_benchmark (Script_typed_ir.Ex_ty ty) = @@ -196,6 +200,8 @@ end = struct let info = "Benchmarking Script_typed_ir_size.kinstr_size" + let module_filename = __FILE__ + let kinstr_size_benchmark rng_state (expr : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = (* FIXME: cleanup and factorize this code between translator benches and these ones. *) @@ -275,6 +281,8 @@ module Node_size_benchmark : Benchmark.S = struct let info = "Benchmarking the time it takes to compute Script_typed_ir_size.node_size" + let module_filename = __FILE__ + let size_based_model = Model.make ~conv:(function {micheline_nodes} -> (micheline_nodes, ())) diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml index 03d06bdb91b33eb99de49a52535888acc4787753..64a07a303a7838761f5ab37a9500cede7249e318 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml @@ -143,6 +143,8 @@ module List_key_values_benchmark_boilerplate = struct let info = "List key values" + let module_filename = __FILE__ + let config_encoding = let open Data_encoding in conv diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml index 8ea1e4dd59709deabb75ac6d29553d39f35bee4a..27fc7edd42b1abf87b86367573f4acef05be0835 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml @@ -81,6 +81,8 @@ module Compare_ticket_hash_benchmark : Benchmark.S = struct let info = "Compare cost for Ticket_hash" + let module_filename = __FILE__ + let compare_model = Model.make ~conv:(fun () -> ()) @@ -137,6 +139,8 @@ module Compare_key_contract_benchmark : Benchmark.S = struct let info = "Compare cost for Contracts" + let module_filename = __FILE__ + let compare_model = Model.make ~conv:(fun () -> ()) @@ -200,6 +204,8 @@ module Has_tickets_type_benchmark : Benchmark.S = struct let info = "Benchmarking type_has_tickets" + let module_filename = __FILE__ + let make_bench_helper rng_state config () = let open Result_syntax in let* ctxt, _ = Lwt_main.run (Execution_context.make ~rng_state) in @@ -260,6 +266,8 @@ module Collect_tickets_benchmark : Benchmark.S = struct let info = "Benchmarking tickets_of_value" + let module_filename = __FILE__ + let make_bench_helper rng_state config () = let open Script_typed_ir in let open Result_syntax in diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/translator_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/translator_benchmarks.ml index 7885440a0bffb4d433329491564b402ae0f40d20..55de65841f1f932dd0f268902aea36110db5c256 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/translator_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/translator_benchmarks.ml @@ -193,6 +193,8 @@ module Typechecking_data : Benchmark.S = struct let info = "Benchmarking typechecking of data" + let module_filename = __FILE__ + let typechecking_data_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Script_repr.expr) = Lwt_main.run @@ -267,6 +269,8 @@ module Unparsing_data : Benchmark.S = struct let info = "Benchmarking unparsing of data" + let module_filename = __FILE__ + let unparsing_data_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Protocol.Script_repr.expr) = Lwt_main.run @@ -348,6 +352,8 @@ module Typechecking_code : Benchmark.S = struct let info = "Benchmarking typechecking of code" + let module_filename = __FILE__ + let typechecking_code_benchmark rng_state (node : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = Lwt_main.run @@ -426,6 +432,8 @@ module Unparsing_code : Benchmark.S = struct let info = "Benchmarking unparsing of code" + let module_filename = __FILE__ + let unparsing_code_benchmark rng_state (node : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = Lwt_main.run @@ -508,6 +516,9 @@ let rec check_printable_ascii v i = let check_printable_benchmark = let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in + let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers.Make (struct + let file = __FILE__ + end) in linear_shared ~name:"CHECK_PRINTABLE" ~generator:(fun rng_state -> @@ -556,6 +567,8 @@ module Ty_eq : Benchmark.S = struct let info = "Benchmarking equating types" + let module_filename = __FILE__ + let tags = [Tags.translator] let intercept_var = Free_variable.of_string (Format.asprintf "%s_const" name) @@ -711,6 +724,8 @@ module Parse_type_benchmark : Benchmark.S = struct let info = "Benchmarking parse_ty" + let module_filename = __FILE__ + let make_bench rng_state config () = ( Lwt_main.run (Execution_context.make ~rng_state) >>? fun (ctxt, _) -> let ctxt = Gas_helpers.set_limit ctxt in @@ -765,6 +780,8 @@ module Unparse_type_benchmark : Benchmark.S = struct let info = "Benchmarking unparse_ty" + let module_filename = __FILE__ + let make_bench rng_state config () = ( Lwt_main.run (Execution_context.make ~rng_state) >>? fun (ctxt, _) -> let ctxt = Gas_helpers.set_limit ctxt in diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 3bb4854bb2c0eb48e79fc76c0a69560b9b87abf6..464106d9497d6a50d5b824594bb73456385550e7 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml @@ -32,6 +32,8 @@ module Inbox_add_message : Benchmark.S = struct let info = "Benchmark for Merkle.add_message" + let module_filename = __FILE__ + let tags = ["tx_rollup"; "merkle"; "inbox"; "add_message"] type config = {max_messages : int} @@ -120,6 +122,8 @@ module Commitment_full_compact_bench : Benchmark.S = struct let info = "Benchmark for Tx_rollup_commitment_repr.Full.compact" + let module_filename = __FILE__ + let tags = ["tx_rollup"; "merkle"; "commitment"; "compact"] type config = {max_messages : int} @@ -552,6 +556,8 @@ module Verify_proof_compute_bench : Benchmark.S = struct let info = "Benchmark for Tx_rollup.verify_proof" + let module_filename = __FILE__ + let tags = ["tx_rollup"; "merkle"; "verify"; "proof"] type config = {max_withdrawals : int} diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/cache_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/cache_benchmarks.ml index 08a410788db8fccc426b99c0cb64215d2e87e7cb..cda89ebf7ca58627c1ba4099f58058ddb166fc90 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/cache_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/cache_benchmarks.ml @@ -133,6 +133,8 @@ module Cache_update_benchmark : Benchmark.S = struct let info = "Benchmarking the time it takes to update a key in the cache" + let module_filename = __FILE__ + (** It is expected that cache keys are non-adversarial, ie do not share a long common prefix. This is the case for [Script_cache], for which the keys are B58-encoded contract hashes. diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/carbonated_map_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/carbonated_map_benchmarks.ml index 119d716a4fa2edf1d8809decbb1d17c642c65f65..3e6c36d66624339c78fa7ea05e16944b18e13608 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/carbonated_map_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/carbonated_map_benchmarks.ml @@ -86,6 +86,8 @@ module Fold_benchmark : Benchmark.S = struct let info = "Carbonated map to list" + let module_filename = __FILE__ + let fold_model = Model.make ~conv:(fun {size} -> (size, ())) @@ -170,6 +172,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated map compare cost for %s keys" CS.type_name + let module_filename = __FILE__ + let models = [ ( "carbonated_map", @@ -206,6 +210,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated find model" + let module_filename = __FILE__ + (** Given the cost of comparing keys, the model is used for deducing [intercept] and [traverse_overhead] from: @@ -306,6 +312,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated find model (intercept case)" + let module_filename = __FILE__ + let models = [ ( "carbonated_map", diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/encodings_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/encodings_benchmarks.ml index 9afaa8331315b1395dea12f124261d157b0c8ace..5e19e2df56a24b2dd14e2ebfdfb2432483bb2716 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/encodings_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/encodings_benchmarks.ml @@ -129,6 +129,8 @@ module Encoding_micheline : Benchmark.S = struct let info = "Benchmarking strip_location + encoding of Micheline to bytes" + let module_filename = __FILE__ + let micheline_serialization_trace (micheline_node : Alpha_context.Script.node) = match @@ -195,6 +197,8 @@ module Decoding_micheline : Benchmark.S = struct let info = "Decoding of bytes to Micheline" + let module_filename = __FILE__ + let micheline_deserialization_trace (micheline_str : string) = match Data_encoding.Binary.of_string @@ -257,27 +261,31 @@ end let () = Registration_helpers.register (module Decoding_micheline) +module Encodings = +Tezos_shell_benchmarks.Encoding_benchmarks_helpers.Make (struct + let file = __FILE__ +end) + module Timestamp = struct let () = Registration_helpers.register - @@ - let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in - fixed_size_shared - ~name:"TIMESTAMP_READABLE_ENCODING" - ~generator:(fun rng_state -> - let seconds_in_year = 30_000_000 in - let offset = Random.State.int rng_state seconds_in_year in - Script_timestamp.of_zint (Z.of_int (1597764116 + offset))) - ~make_bench:(fun generator () -> - let tstamp_string = generator () in - let closure () = ignore (Script_timestamp.to_notation tstamp_string) in - Generator.Plain {workload = (); closure}) - () + @@ Encodings.fixed_size_shared + ~name:"TIMESTAMP_READABLE_ENCODING" + ~generator:(fun rng_state -> + let seconds_in_year = 30_000_000 in + let offset = Random.State.int rng_state seconds_in_year in + Script_timestamp.of_zint (Z.of_int (1597764116 + offset))) + ~make_bench:(fun generator () -> + let tstamp_string = generator () in + let closure () = + ignore (Script_timestamp.to_notation tstamp_string) + in + Generator.Plain {workload = (); closure}) + () let () = let b, b_intercept = - let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in - nsqrtn_shared_with_intercept + Encodings.nsqrtn_shared_with_intercept ~name:"TIMESTAMP_READABLE_DECODING" ~generator:(fun rng_state -> let offset = @@ -312,8 +320,6 @@ end https://gitlab.com/dannywillems/ocaml-bls12-381/-/blob/71d0b4d467fbfaa6452d702fcc408d7a70916a80/README.md#install *) module BLS = struct - open Tezos_shell_benchmarks.Encoding_benchmarks_helpers - let check () = if not Bls12_381.built_with_blst_portable then ( Format.eprintf @@ -324,7 +330,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_bytes + @@ Encodings.make_encode_fixed_size_to_bytes ~check ~name:"ENCODING_BLS_FR" ~to_bytes:Bls12_381.Fr.to_bytes @@ -333,7 +339,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_bytes + @@ Encodings.make_encode_fixed_size_to_bytes ~check ~name:"ENCODING_BLS_G1" ~to_bytes:Bls12_381.G1.to_bytes @@ -342,7 +348,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_bytes + @@ Encodings.make_encode_fixed_size_to_bytes ~check ~name:"ENCODING_BLS_G2" ~to_bytes:Bls12_381.G2.to_bytes @@ -351,7 +357,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~check ~name:"DECODING_BLS_FR" ~to_bytes:Bls12_381.Fr.to_bytes @@ -361,7 +367,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~check ~name:"DECODING_BLS_G1" ~to_bytes:Bls12_381.G1.to_bytes @@ -371,7 +377,7 @@ module BLS = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~check ~name:"DECODING_BLS_G2" ~to_bytes:Bls12_381.G2.to_bytes @@ -381,7 +387,7 @@ module BLS = struct let () = Registration_helpers.register - @@ fixed_size_shared + @@ Encodings.fixed_size_shared ~check ~name:"BLS_FR_FROM_Z" ~generator:(fun rng_state -> Bls12_381.Fr.random ~state:rng_state ()) @@ -394,7 +400,7 @@ module BLS = struct let () = Registration_helpers.register - @@ fixed_size_shared + @@ Encodings.fixed_size_shared ~check ~name:"BLS_FR_TO_Z" ~generator:(fun rng_state -> Bls12_381.Fr.random ~state:rng_state ()) @@ -406,8 +412,6 @@ module BLS = struct end module Timelock = struct - open Tezos_shell_benchmarks.Encoding_benchmarks_helpers - let generator rng_state = let log_time = Base_samplers.sample_in_interval ~range:{min = 0; max = 29} rng_state @@ -423,7 +427,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_encode_variable_size_to_string + @@ Encodings.make_encode_variable_size_to_string ~name:"ENCODING_Chest" ~to_string: (Data_encoding.Binary.to_string_exn @@ -435,7 +439,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_encode_fixed_size_to_string + @@ Encodings.make_encode_fixed_size_to_string ~name:"ENCODING_Chest_key" ~to_string: (Data_encoding.Binary.to_string_exn @@ -447,7 +451,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_decode_variable_size_from_bytes + @@ Encodings.make_decode_variable_size_from_bytes ~name:"DECODING_Chest" ~to_bytes: (Data_encoding.Binary.to_bytes_exn @@ -467,7 +471,7 @@ module Timelock = struct let () = Registration_helpers.register - @@ make_decode_fixed_size_from_bytes + @@ Encodings.make_decode_fixed_size_from_bytes ~name:"DECODING_Chest_key" ~to_bytes: (Data_encoding.Binary.to_bytes_exn diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/global_constants_storage_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/global_constants_storage_benchmarks.ml index 2a3030a39ee9dfe0133087da875ab722d7384078..b32a7eefce5134be0f9bcb4d50a29337758326e4 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/global_constants_storage_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/global_constants_storage_benchmarks.ml @@ -296,6 +296,8 @@ module Set_add : Benchmark.S = struct let info = "Benchmarks and cost model for set element addition from OCaml stdlib." + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -349,6 +351,8 @@ module Set_elements : Benchmark.S = struct let info = "Benchmarks and cost model for set elements from OCaml stdlib." + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -404,6 +408,8 @@ module Script_expr_hash_of_b58check_opt : Benchmark.S = struct let info = "Benchmark for Script_expr_hash.of_b58check_opt" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -476,6 +482,8 @@ struct Global_constants_storage.Internal_for_tests.expr_to_address_in_context \ function" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -559,6 +567,8 @@ module Global_constants_storage_expand_models = struct "Benchmark for the constant branch Global_constants_storage.expand \ function" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -633,6 +643,8 @@ module Global_constants_storage_expand_models = struct "Benchmark for the Global_constants_storage.expand function on the case \ without constants" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml index a8e752fb614c61d61c7279bcf7291c49a74a1fff..a3c850235db0e9c61cdbd512dfbe7b5dd5480937 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -261,6 +261,8 @@ let make_benchmark : let tags = tags @ more_tags + let module_filename = __FILE__ + let models = (* [intercept = true] implies there's a benchmark with [intercept = false]. No need to register the model twice. *) @@ -542,6 +544,8 @@ let make_continuation_benchmark : include Default_config include Default_boilerplate + let module_filename = __FILE__ + let tags = tags @ more_tags let models = Interpreter_model.make_model ?amplification (Cont_name name) @@ -647,6 +651,8 @@ module Registration_section = struct let info = "Benchmarking the cost of an empty loop" + let module_filename = __FILE__ + let tags = [Tags.interpreter] type config = {max_iterations : int} @@ -2696,6 +2702,8 @@ module Registration_section = struct let info = info + let module_filename = __FILE__ + include Default_config include Default_boilerplate diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/sapling_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/sapling_benchmarks.ml index 1ceef0bfd148f8951cb5c8d0e14c702952ea8141..63955d43b65d6305b7e8c6e640e649851888f739 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/sapling_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/sapling_benchmarks.ml @@ -38,6 +38,8 @@ module Apply_diff_bench : Benchmark.S = struct let info = "Benchmarking SAPLING_APPLY_DIFF" + let module_filename = __FILE__ + let tags = ["sapling"] let diff_from_tx (tx : Alpha_context.Sapling.transaction) = diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/sc_rollup_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/sc_rollup_benchmarks.ml index 3d2ddcd056ee152e6f70ffb2dfa43ddfb35a345f..790ffda4a01b523030bb54151b7c9c2d513f2f7d 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/sc_rollup_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/sc_rollup_benchmarks.ml @@ -288,6 +288,8 @@ module Sc_rollup_verify_output_proof_benchmark = struct let info = "Estimating the cost of verifying an output proof" + let module_filename = __FILE__ + let tags = ["sc_rollup"] type config = { @@ -503,6 +505,8 @@ module Sc_rollup_deserialize_output_proof_benchmark = struct let info = "Estimating the cost of deserializing an output proof" + let module_filename = __FILE__ + let tags = ["sc_rollup"] type config = { diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/script_repr_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/script_repr_benchmarks.ml index 62931e72ea82cbe9fbcec8f9514caa414b0a24ec..3823502d4ee242ab683ea2fea9646984b5e81d24 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/script_repr_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/script_repr_benchmarks.ml @@ -80,6 +80,8 @@ module Micheline_nodes_benchmark : Benchmark.S = struct "Benchmarking the time it takes to compute the number of nodes of a \ Micheline term" + let module_filename = __FILE__ + let size_based_model = Model.make ~conv:(function {micheline_nodes} -> (micheline_nodes, ())) @@ -124,6 +126,8 @@ module Script_repr_strip_annotations : Benchmark.S = struct let info = "Benchmarking Script_repr.strip_annotations" + let module_filename = __FILE__ + let strip_annotations_model = Model.( make diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml index eac71521640531b9971b5e105477d795f8df6a2c..f21095fe7411be1973c899b71844de0abf1f3f4f 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml @@ -77,6 +77,8 @@ end = struct let info = "Benchmarking Script_typed_ir_size.value_size" + let module_filename = __FILE__ + let value_size_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Script_repr.expr) = (* FIXME: cleanup and factorize this code between translator benches and these ones. *) @@ -148,6 +150,8 @@ module Type_size_benchmark : Tezos_benchmark.Benchmark.S = struct let info = "Benchmarking the time it takes to compute Script_typed_ir_size.ty_size" + let module_filename = __FILE__ + let models = [(model_name, size_based_model (Namespace.basename name))] let type_size_benchmark (Script_typed_ir.Ex_ty ty) = @@ -190,6 +194,8 @@ end = struct let info = "Benchmarking Script_typed_ir_size.kinstr_size" + let module_filename = __FILE__ + let kinstr_size_benchmark rng_state (expr : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = (* FIXME: cleanup and factorize this code between translator benches and these ones. *) @@ -267,6 +273,8 @@ module Node_size_benchmark : Benchmark.S = struct let info = "Benchmarking the time it takes to compute Script_typed_ir_size.node_size" + let module_filename = __FILE__ + let size_based_model = Model.make ~conv:(function {micheline_nodes} -> (micheline_nodes, ())) diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/skip_list_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/skip_list_benchmarks.ml index 5125478a75ab1faffc22ef9ed6dea94b063acd92..3be54fc0b0145f5c5316108ec924af34ebb99823 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/skip_list_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/skip_list_benchmarks.ml @@ -45,6 +45,8 @@ module Next : Benchmark.S = struct let info = "Benchmark for Skip_list_repr.next" + let module_filename = __FILE__ + let tags = ["skip_list"] type config = {max_items : int} @@ -97,6 +99,8 @@ module Hash_cell = struct let info = "Estimating the costs of hashing a skip list cell" + let module_filename = __FILE__ + let tags = ["skip_list"] include Skip_list diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml index 4967805a7b75acb8a1c10f38f85d890dd49b0e05..0f85b7714aad700e78e568357e80f3d0d7f3aaa7 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml @@ -145,6 +145,8 @@ module List_key_values_benchmark_boilerplate = struct let info = "List key values" + let module_filename = __FILE__ + let config_encoding = let open Data_encoding in conv diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml index 8e37c1989a1bd3047d208a40c443eb5f6bc3ba55..521038eec8c936a87111c0559cd11e70ffc696e0 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml @@ -83,6 +83,8 @@ module Compare_ticket_hash_benchmark : Benchmark.S = struct let info = "Compare cost for Ticket_hash" + let module_filename = __FILE__ + let compare_model = Model.make ~conv:(fun () -> ()) @@ -139,6 +141,8 @@ module Compare_key_contract_benchmark : Benchmark.S = struct let info = "Compare cost for Contracts" + let module_filename = __FILE__ + let compare_model = Model.make ~conv:(fun () -> ()) @@ -202,6 +206,8 @@ module Has_tickets_type_benchmark : Benchmark.S = struct let info = "Benchmarking type_has_tickets" + let module_filename = __FILE__ + let make_bench_helper rng_state config () = let open Result_syntax in let* ctxt, _ = Lwt_main.run (Execution_context.make ~rng_state) in @@ -265,6 +271,8 @@ module Collect_tickets_benchmark : Benchmark.S = struct let info = "Benchmarking tickets_of_value" + let module_filename = __FILE__ + let make_bench_helper rng_state config () = let open Script_typed_ir in let open Result_syntax in diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/translator_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/translator_benchmarks.ml index f7c6ec25ea514c1da245ad5b50cfe9e1f256b4e5..1f5a79acdbb66dfcc4b313e015f7d53bbf0daf06 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/translator_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/translator_benchmarks.ml @@ -195,6 +195,8 @@ module Typechecking_data : Benchmark.S = struct let info = "Benchmarking typechecking of data" + let module_filename = __FILE__ + let typechecking_data_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Script_repr.expr) = Lwt_main.run @@ -267,6 +269,8 @@ module Unparsing_data : Benchmark.S = struct let info = "Benchmarking unparsing of data" + let module_filename = __FILE__ + let unparsing_data_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Protocol.Script_repr.expr) = Lwt_main.run @@ -346,6 +350,8 @@ module Typechecking_code : Benchmark.S = struct let info = "Benchmarking typechecking of code" + let module_filename = __FILE__ + let typechecking_code_benchmark rng_state (node : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = Lwt_main.run @@ -422,6 +428,8 @@ module Unparsing_code : Benchmark.S = struct let info = "Benchmarking unparsing of code" + let module_filename = __FILE__ + let unparsing_code_benchmark rng_state (node : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = Lwt_main.run @@ -502,6 +510,9 @@ let rec check_printable_ascii v i = let check_printable_benchmark = let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in + let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers.Make (struct + let file = __FILE__ + end) in linear_shared ~name:"CHECK_PRINTABLE" ~generator:(fun rng_state -> @@ -550,6 +561,8 @@ module Ty_eq : Benchmark.S = struct let info = "Benchmarking equating types" + let module_filename = __FILE__ + let tags = [Tags.translator] let intercept_var = fv (Format.asprintf "%s_const" (Namespace.basename name)) @@ -706,6 +719,8 @@ module Parse_type_benchmark : Benchmark.S = struct let info = "Benchmarking parse_ty" + let module_filename = __FILE__ + let make_bench rng_state config () = ( Lwt_main.run (Execution_context.make ~rng_state) >>? fun (ctxt, _) -> let ctxt = Gas_helpers.set_limit ctxt in @@ -758,6 +773,8 @@ module Unparse_type_benchmark : Benchmark.S = struct let info = "Benchmarking unparse_ty" + let module_filename = __FILE__ + let make_bench rng_state config () = ( Lwt_main.run (Execution_context.make ~rng_state) >>? fun (ctxt, _) -> let ctxt = Gas_helpers.set_limit ctxt in diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 8dfaf211d7dbc95999af96516574ae1418332d29..04ce5cba93db19b66fe07508cfaa3c083890ce0c 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml @@ -34,6 +34,8 @@ module Inbox_add_message : Benchmark.S = struct let info = "Benchmark for Merkle.add_message" + let module_filename = __FILE__ + let tags = ["tx_rollup"; "merkle"; "inbox"; "add_message"] type config = {max_messages : int} @@ -116,6 +118,8 @@ module Commitment_full_compact_bench : Benchmark.S = struct let info = "Benchmark for Tx_rollup_commitment_repr.Full.compact" + let module_filename = __FILE__ + let tags = ["tx_rollup"; "merkle"; "commitment"; "compact"] type config = {max_messages : int} @@ -545,6 +549,8 @@ module Verify_proof_compute_bench : Benchmark.S = struct let info = "Benchmark for Tx_rollup.verify_proof" + let module_filename = __FILE__ + let tags = ["tx_rollup"; "merkle"; "verify"; "proof"] type config = {max_withdrawals : int} diff --git a/src/proto_alpha/lib_benchmarks_proto/apply_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/apply_benchmarks.ml index 5908a289e5523aea68d9a8e106ac7446e53cce0e..02cd860880e73d9bcb3137bc0a93a16dba69dace 100644 --- a/src/proto_alpha/lib_benchmarks_proto/apply_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/apply_benchmarks.ml @@ -62,6 +62,8 @@ module Take_fees_benchmark = struct let info = "Benchmark for take_fees" + let module_filename = __FILE__ + let tags = ["apply"] type config = unit diff --git a/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.ml b/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.ml index 8e29cbe743e3700304f52345fcc0e2a5acf8bf36..a541164ad48cdc23ea9dcab2c4b0b322b3728694 100644 --- a/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.ml +++ b/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.ml @@ -31,7 +31,7 @@ module Benchmark = struct val info : string - val module_location : string + val module_filename : string val tags : string list diff --git a/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.mli b/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.mli index 87b96d5ba4292f93d4273fa446c953f5283cb0e0..d3852c8aaad1bde8f07ddd5a0445bd442c85ca53 100644 --- a/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.mli +++ b/src/proto_alpha/lib_benchmarks_proto/benchmarks_proto.mli @@ -36,7 +36,7 @@ module Benchmark : sig val info : string (** Filename of the benchmark module *) - val module_location : string + val module_filename : string (** Tags of the benchmark *) val tags : string list diff --git a/src/proto_alpha/lib_benchmarks_proto/cache_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/cache_benchmarks.ml index 08a410788db8fccc426b99c0cb64215d2e87e7cb..cda89ebf7ca58627c1ba4099f58058ddb166fc90 100644 --- a/src/proto_alpha/lib_benchmarks_proto/cache_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/cache_benchmarks.ml @@ -133,6 +133,8 @@ module Cache_update_benchmark : Benchmark.S = struct let info = "Benchmarking the time it takes to update a key in the cache" + let module_filename = __FILE__ + (** It is expected that cache keys are non-adversarial, ie do not share a long common prefix. This is the case for [Script_cache], for which the keys are B58-encoded contract hashes. diff --git a/src/proto_alpha/lib_benchmarks_proto/carbonated_map_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/carbonated_map_benchmarks.ml index c97db5d440815e0e3b8e5d2901242d8588d67003..6f99987cd0402844421e58b8e6d5dd1a44926ebf 100644 --- a/src/proto_alpha/lib_benchmarks_proto/carbonated_map_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/carbonated_map_benchmarks.ml @@ -45,6 +45,8 @@ module Config_and_workload = struct type workload = config + let module_filename = __FILE__ + let tags = ["carbonated_map"] let workload_encoding = config_encoding @@ -161,6 +163,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated map compare cost for %s keys" CS.type_name + let module_filename = __FILE__ + let models = [ ( "carbonated_map", @@ -298,6 +302,8 @@ module Make (CS : COMPARABLE_SAMPLER) = struct let info = Printf.sprintf "Carbonated find model (intercept case)" + let module_filename = __FILE__ + let models = [ ( "carbonated_map", diff --git a/src/proto_alpha/lib_benchmarks_proto/encodings_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/encodings_benchmarks.ml index 9afaa8331315b1395dea12f124261d157b0c8ace..34027d0f0834f431218fb06526c2565b019bb3bf 100644 --- a/src/proto_alpha/lib_benchmarks_proto/encodings_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/encodings_benchmarks.ml @@ -24,6 +24,12 @@ (*****************************************************************************) open Protocol + +module Encodings = +Tezos_shell_benchmarks.Encoding_benchmarks_helpers.Make (struct + let file = __FILE__ +end) + module Size = Gas_input_size let ns = Namespace.make Registration_helpers.ns "encoding" @@ -129,6 +135,8 @@ module Encoding_micheline : Benchmark.S = struct let info = "Benchmarking strip_location + encoding of Micheline to bytes" + let module_filename = __FILE__ + let micheline_serialization_trace (micheline_node : Alpha_context.Script.node) = match @@ -195,6 +203,8 @@ module Decoding_micheline : Benchmark.S = struct let info = "Decoding of bytes to Micheline" + let module_filename = __FILE__ + let micheline_deserialization_trace (micheline_str : string) = match Data_encoding.Binary.of_string @@ -258,25 +268,26 @@ end let () = Registration_helpers.register (module Decoding_micheline) module Timestamp = struct + open Encodings + let () = Registration_helpers.register - @@ - let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in - fixed_size_shared - ~name:"TIMESTAMP_READABLE_ENCODING" - ~generator:(fun rng_state -> - let seconds_in_year = 30_000_000 in - let offset = Random.State.int rng_state seconds_in_year in - Script_timestamp.of_zint (Z.of_int (1597764116 + offset))) - ~make_bench:(fun generator () -> - let tstamp_string = generator () in - let closure () = ignore (Script_timestamp.to_notation tstamp_string) in - Generator.Plain {workload = (); closure}) - () + @@ fixed_size_shared + ~name:"TIMESTAMP_READABLE_ENCODING" + ~generator:(fun rng_state -> + let seconds_in_year = 30_000_000 in + let offset = Random.State.int rng_state seconds_in_year in + Script_timestamp.of_zint (Z.of_int (1597764116 + offset))) + ~make_bench:(fun generator () -> + let tstamp_string = generator () in + let closure () = + ignore (Script_timestamp.to_notation tstamp_string) + in + Generator.Plain {workload = (); closure}) + () let () = let b, b_intercept = - let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in nsqrtn_shared_with_intercept ~name:"TIMESTAMP_READABLE_DECODING" ~generator:(fun rng_state -> @@ -312,7 +323,7 @@ end https://gitlab.com/dannywillems/ocaml-bls12-381/-/blob/71d0b4d467fbfaa6452d702fcc408d7a70916a80/README.md#install *) module BLS = struct - open Tezos_shell_benchmarks.Encoding_benchmarks_helpers + open Encodings let check () = if not Bls12_381.built_with_blst_portable then ( @@ -406,7 +417,7 @@ module BLS = struct end module Timelock = struct - open Tezos_shell_benchmarks.Encoding_benchmarks_helpers + open Encodings let generator rng_state = let log_time = diff --git a/src/proto_alpha/lib_benchmarks_proto/global_constants_storage_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/global_constants_storage_benchmarks.ml index f264413739992e4f06f129ea809d70d493312164..39859a11d5a60174114cf6d3f60bb412b83a2cbd 100644 --- a/src/proto_alpha/lib_benchmarks_proto/global_constants_storage_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/global_constants_storage_benchmarks.ml @@ -296,6 +296,8 @@ module Set_add : Benchmark.S = struct let info = "Benchmarks and cost model for set element addition from OCaml stdlib." + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -347,6 +349,8 @@ module Set_elements : Benchmark.S = struct let info = "Benchmarks and cost model for set elements from OCaml stdlib." + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -400,6 +404,8 @@ module Script_expr_hash_of_b58check_opt : Benchmark.S = struct let info = "Benchmark for Script_expr_hash.of_b58check_opt" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -468,6 +474,8 @@ struct Global_constants_storage.Internal_for_tests.expr_to_address_in_context \ function" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -548,6 +556,8 @@ module Global_constants_storage_expand_models = struct "Benchmark for the constant branch Global_constants_storage.expand \ function" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit @@ -619,6 +629,8 @@ module Global_constants_storage_expand_models = struct "Benchmark for the Global_constants_storage.expand function on the case \ without constants" + let module_filename = __FILE__ + let tags = ["global_constants"] type config = unit diff --git a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml index f1ca84c307436c730d04d162cc201dee1ae38dd6..73ec037dd88b8f7abe73efb15ce5d49149c12f01 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -272,6 +272,8 @@ let make_benchmark : ?salt (Interpreter_workload.string_of_instruction_name name) + let module_filename = __FILE__ + let benchmark kinstr_and_stack_sampler ctxt step_constants () = let stack_instr = kinstr_and_stack_sampler () in benchmark_from_kinstr_and_stack @@ -552,6 +554,8 @@ let make_continuation_benchmark : ?salt (Interpreter_workload.string_of_continuation_name name) + let module_filename = __FILE__ + let benchmark cont_and_stack_sampler ctxt step_constants () = let stack_instr = cont_and_stack_sampler () in benchmark_from_continuation ?amplification ctxt step_constants stack_instr @@ -647,6 +651,8 @@ module Registration_section = struct let info = "Benchmarking the cost of an empty loop" + let module_filename = __FILE__ + let tags = [Tags.interpreter] type config = {max_iterations : int} @@ -2716,6 +2722,8 @@ module Registration_section = struct let info = info + let module_filename = __FILE__ + include Default_config include Default_boilerplate diff --git a/src/proto_alpha/lib_benchmarks_proto/sapling_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/sapling_benchmarks.ml index 1ceef0bfd148f8951cb5c8d0e14c702952ea8141..63955d43b65d6305b7e8c6e640e649851888f739 100644 --- a/src/proto_alpha/lib_benchmarks_proto/sapling_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/sapling_benchmarks.ml @@ -38,6 +38,8 @@ module Apply_diff_bench : Benchmark.S = struct let info = "Benchmarking SAPLING_APPLY_DIFF" + let module_filename = __FILE__ + let tags = ["sapling"] let diff_from_tx (tx : Alpha_context.Sapling.transaction) = diff --git a/src/proto_alpha/lib_benchmarks_proto/sc_rollup_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/sc_rollup_benchmarks.ml index a5b91d0c80ef21ea74827e1fc365b55ad048e01d..e5f8f7dddb0bd704dac445b9f481d09a9b1624e7 100644 --- a/src/proto_alpha/lib_benchmarks_proto/sc_rollup_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/sc_rollup_benchmarks.ml @@ -288,6 +288,8 @@ module Sc_rollup_verify_output_proof_benchmark = struct let info = "Estimating the cost of verifying an output proof" + let module_filename = __FILE__ + let tags = ["sc_rollup"] type config = { @@ -503,6 +505,8 @@ module Sc_rollup_deserialize_output_proof_benchmark = struct let info = "Estimating the cost of deserializing an output proof" + let module_filename = __FILE__ + let tags = ["sc_rollup"] type config = { diff --git a/src/proto_alpha/lib_benchmarks_proto/script_repr_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/script_repr_benchmarks.ml index f63a51c97fc59e015f1f059155900709da681d9d..a69895df80f081d7ad41cc26efd047686bae7665 100644 --- a/src/proto_alpha/lib_benchmarks_proto/script_repr_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/script_repr_benchmarks.ml @@ -80,6 +80,8 @@ module Micheline_nodes_benchmark : Benchmark.S = struct "Benchmarking the time it takes to compute the number of nodes of a \ Micheline term" + let module_filename = __FILE__ + let size_based_model = Model.make ~conv:(function {micheline_nodes} -> (micheline_nodes, ())) @@ -119,6 +121,8 @@ module Script_repr_strip_annotations : Benchmark.S = struct let info = "Benchmarking Script_repr.strip_annotations" + let module_filename = __FILE__ + let strip_annotations_model = Model.( make diff --git a/src/proto_alpha/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml index 47f819f202319f29f24a36480b73e0c2848ef6c8..bbcdc23ca0d9680103cab7ed48af8c18a88fa854 100644 --- a/src/proto_alpha/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml @@ -77,6 +77,8 @@ end = struct let info = "Benchmarking Script_typed_ir_size.value_size" + let module_filename = __FILE__ + let value_size_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Script_repr.expr) = (* FIXME: cleanup and factorize this code between translator benches and these ones. *) @@ -148,6 +150,8 @@ module Type_size_benchmark : Tezos_benchmark.Benchmark.S = struct let info = "Benchmarking the time it takes to compute Script_typed_ir_size.ty_size" + let module_filename = __FILE__ + let models = [(model_name, size_based_model (Namespace.basename name))] let type_size_benchmark (Script_typed_ir.Ex_ty ty) = @@ -190,6 +194,8 @@ end = struct let info = "Benchmarking Script_typed_ir_size.kinstr_size" + let module_filename = __FILE__ + let kinstr_size_benchmark rng_state (expr : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = (* FIXME: cleanup and factorize this code between translator benches and these ones. *) @@ -267,6 +273,8 @@ module Node_size_benchmark : Benchmark.S = struct let info = "Benchmarking the time it takes to compute Script_typed_ir_size.node_size" + let module_filename = __FILE__ + let size_based_model = Model.make ~conv:(function {micheline_nodes} -> (micheline_nodes, ())) diff --git a/src/proto_alpha/lib_benchmarks_proto/skip_list_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/skip_list_benchmarks.ml index c502f171e8fd712d105c56ded4e2404dfc2e2dab..ee4592c769e17837681f2ee06327c53fbbe7af6a 100644 --- a/src/proto_alpha/lib_benchmarks_proto/skip_list_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/skip_list_benchmarks.ml @@ -54,7 +54,7 @@ module Next : Benchmark.S = struct let default_config = {max_items = 10000} - let module_location = __FILE__ + let module_filename = __FILE__ let config_encoding = let open Data_encoding in @@ -106,7 +106,7 @@ module Hash_cell : Benchmark.S = struct let tags = ["skip_list"] - let module_location = __FILE__ + let module_filename = __FILE__ include Skip_list module Hash = Sc_rollup_inbox_repr.Hash diff --git a/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml index 4353cc14b6967a3f0da9e1aa2583fa757ba350ad..467777dff54663777b3e76f20e54de1924dc2e6e 100644 --- a/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml @@ -181,6 +181,8 @@ end module List_key_values_benchmark = struct include List_key_values_benchmark_boilerplate + let module_filename = __FILE__ + let benchmark rng_state {max_size} () = let wrap m = m >|= Environment.wrap_tzresult in let size = @@ -219,6 +221,8 @@ module List_key_values_benchmark_intercept = struct let name = Namespace.make ns (Namespace.basename name) "intercept" + let module_filename = __FILE__ + let benchmark _rng_state _config () = let ctxt = match Lwt_main.run (default_raw_context ()) with diff --git a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml index 28b2bb8aa9df322c65bd7c5fb62a53affea31661..471f90a4ee49b19dc01d157bb1f74a3b30562290 100644 --- a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml @@ -83,6 +83,8 @@ module Compare_ticket_hash_benchmark : Benchmark.S = struct let info = "Compare cost for Ticket_hash" + let module_filename = __FILE__ + let compare_model = Model.make ~conv:(fun () -> ()) @@ -134,6 +136,8 @@ module Compare_key_contract_benchmark : Benchmark.S = struct let info = "Compare cost for Contracts" + let module_filename = __FILE__ + let compare_model = Model.make ~conv:(fun () -> ()) @@ -192,6 +196,8 @@ module Has_tickets_type_benchmark : Benchmark.S = struct let info = "Benchmarking type_has_tickets" + let module_filename = __FILE__ + let make_bench_helper rng_state config () = let open Result_syntax in let* ctxt, _ = Lwt_main.run (Execution_context.make ~rng_state) in @@ -245,6 +251,8 @@ module Collect_tickets_benchmark : Benchmark.S = struct let info = "Benchmarking tickets_of_value" + let module_filename = __FILE__ + let make_bench_helper rng_state config () = let open Script_typed_ir in let open Result_syntax in diff --git a/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml index 3fd1ac14ae8e4f9f6db92d0a815e26268065e83b..1ac41b09d433dcbc3d5d5f53446778d0995b91d8 100644 --- a/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/translator_benchmarks.ml @@ -24,6 +24,12 @@ (*****************************************************************************) open Protocol + +module Encodings = +Tezos_shell_benchmarks.Encoding_benchmarks_helpers.Make (struct + let file = __FILE__ +end) + module Size = Gas_input_size let ns = Translator_model.ns @@ -195,6 +201,8 @@ module Typechecking_data : Benchmark.S = struct let info = "Benchmarking typechecking of data" + let module_filename = __FILE__ + let typechecking_data_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Script_repr.expr) = Lwt_main.run @@ -267,6 +275,8 @@ module Unparsing_data : Benchmark.S = struct let info = "Benchmarking unparsing of data" + let module_filename = __FILE__ + let unparsing_data_benchmark rng_state (node : Protocol.Script_repr.expr) (michelson_type : Protocol.Script_repr.expr) = Lwt_main.run @@ -346,6 +356,8 @@ module Typechecking_code : Benchmark.S = struct let info = "Benchmarking typechecking of code" + let module_filename = __FILE__ + let typechecking_code_benchmark rng_state (node : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = Lwt_main.run @@ -422,6 +434,8 @@ module Unparsing_code : Benchmark.S = struct let info = "Benchmarking unparsing of code" + let module_filename = __FILE__ + let unparsing_code_benchmark rng_state (node : Protocol.Script_repr.expr) (stack : Script_repr.expr list) = Lwt_main.run @@ -502,6 +516,7 @@ let rec check_printable_ascii v i = let check_printable_benchmark = let open Tezos_shell_benchmarks.Encoding_benchmarks_helpers in + let open Encodings in linear_shared ~name:"CHECK_PRINTABLE" ~generator:(fun rng_state -> @@ -550,6 +565,8 @@ module Ty_eq : Benchmark.S = struct let info = "Benchmarking equating types" + let module_filename = __FILE__ + let tags = [Tags.translator] let intercept_var = fv (Format.asprintf "%s_const" (Namespace.basename name)) @@ -695,6 +712,8 @@ module Parse_type_benchmark : Benchmark.S = struct let info = "Benchmarking parse_ty" + let module_filename = __FILE__ + let make_bench rng_state config () = ( Lwt_main.run (Execution_context.make ~rng_state) >>? fun (ctxt, _) -> let ctxt = Gas_helpers.set_limit ctxt in @@ -747,6 +766,8 @@ module Unparse_type_benchmark : Benchmark.S = struct let info = "Benchmarking unparse_ty" + let module_filename = __FILE__ + let make_bench rng_state config () = ( Lwt_main.run (Execution_context.make ~rng_state) >>? fun (ctxt, _) -> let ctxt = Gas_helpers.set_limit ctxt in