Utils.ProfilerWall-clock profiler for the four algorithmic phases: TeacherMem, TeacherEq, LearnerEnc, LearnerSolve. on ctx f runs f under ctx, restoring the previous context on exit.
module Log : sig ... endtype t = {teacher_mem : Base.float;teacher_eq : Base.float;learner_enc : Base.float;learner_solve : Base.float;misc : Base.float;combined : Base.float;}Per-phase wall-clock times (seconds) for one learning run. combined is the sum of the four named phases; misc covers everything not attributed to a specific phase (e.g. WFA construction, statistics collection).
val pp :
Ppx_deriving_runtime.Format.formatter ->
t ->
Ppx_deriving_runtime.unitval show : t -> Ppx_deriving_runtime.stringval yojson_of_t : t -> Ppx_yojson_conv_lib.Yojson.Safe.tval zero_stats : tIdentifies which phase of the algorithm is currently executing. Switching context via switch or on causes elapsed time since the last switch to be charged to the departing phase.
Global mutable profiler state. A single-threaded design is intentional: the learner is sequential and nesting on calls correctly restores the previous context via Stdlib.Fun.protect.
val state : stateval switch : context -> unitswitch ctx charges elapsed time to the current context, then transitions to ctx and records the new timestamp.
val lap : unit -> tSnapshot current stats and reset counters to zero
val on : context -> (unit -> 'a) -> 'aon ctx f runs f () while attributing elapsed time to ctx. Restores the previous context even if f raises, via Fun.protect.