Logging, runtime tracing, and the obs performance profiler for OCaml
0

Configure Feed

Select the types of activity you want to include in your feed.

console: rename nox-tty to console

The nox- prefix existed only because the bare name tty is taken on
central opam. console is free there and says what the library is:
inline styled terminal output rather than a full-screen TUI. Rename
the opam packages (nox-tty -> console, nox-tty-eio -> console-eio),
the modules (Tty -> Console, Tty_eio -> Console_eio), the C stub
namespace, the repository directory (ocaml-tty -> ocaml-console) and
the bundled Claude skill, and update every in-tree consumer. The
tangled repo must be renamed to ocaml-console to match before the
next monopam push.

+18 -13
+9 -7
bin/obs/cmd_common.ml
··· 56 56 findings 57 57 58 58 let summary_ctx ~isatty = 59 - Tty.Display.ctx ~ppf:Fmt.stdout 59 + Console.Display.ctx ~ppf:Fmt.stdout 60 60 ~now:(fun () -> 0.) 61 61 ~dimensions:(fun () -> (100, 24)) 62 62 ~is_tty:isatty () 63 63 64 64 let render_table ~ctx ~theme cols rows = 65 - Fmt.pr "%a@." (Tty.Table.pp ~ctx) (Tty.Table.of_string_rows ~theme cols rows) 65 + Fmt.pr "%a@." (Console.Table.pp ~ctx) 66 + (Console.Table.of_string_rows ~theme cols rows) 66 67 67 68 let render_verdict ~theme (r : Report.t) = 68 - Fmt.pr "%a@." Tty.Panel.pp 69 - (Tty.Panel.v ~theme ~title:(Tty.Span.text "obs") (Tty.Span.text r.verdict)) 69 + Fmt.pr "%a@." Console.Panel.pp 70 + (Console.Panel.v ~theme ~title:(Console.Span.text "obs") 71 + (Console.Span.text r.verdict)) 70 72 71 73 let render_budget ~ctx ~theme ~unattributed bd = 72 74 render_table ~ctx ~theme 73 - Tty.Table. 75 + Console.Table. 74 76 [ 75 77 column "budget"; 76 78 column ~align:`Right "time"; ··· 83 85 Fmt.pr "findings: none above the floor; run looks balanced@." 84 86 else 85 87 render_table ~ctx ~theme 86 - Tty.Table. 88 + Console.Table. 87 89 [ 88 90 column "#"; 89 91 column "kind"; ··· 103 105 wall-clock budget, and the ranked findings. Colour follows the formatter's 104 106 style renderer, so a pipe or [--json] stays plain. *) 105 107 let render_summary_tty (r : Report.t) = 106 - let theme = Tty.Theme.matrix in 108 + let theme = Console.Theme.matrix in 107 109 let isatty = Unix.isatty Unix.stdout in 108 110 Fmt.set_style_renderer Fmt.stdout (if isatty then `Ansi_tty else `None); 109 111 let ctx = summary_ctx ~isatty in
+6 -3
bin/obs/cmd_hotspots.ml
··· 47 47 let min_w = max 1 (total / 100) in 48 48 let rec span_node name node = 49 49 let pct = if total = 0 then 0. else 100. *. float node.w /. float total in 50 - let label = Fmt.kstr Tty.Span.text "%s %d w (%.1f%%)" name node.w pct in 50 + let label = 51 + Fmt.kstr Console.Span.text "%s %d w (%.1f%%)" name node.w pct 52 + in 51 53 let kids = 52 54 Hashtbl.fold 53 55 (fun k v acc -> if v.w >= min_w then (k, v) :: acc else acc) 54 56 node.kids [] 55 57 |> List.sort (fun (_, a) (_, b) -> Int.compare b.w a.w) 56 58 in 57 - Tty.Tree.Node (label, List.map (fun (k, v) -> span_node k v) kids) 59 + Console.Tree.Node (label, List.map (fun (k, v) -> span_node k v) kids) 58 60 in 59 - Tty.Tree.to_string (Tty.Tree.of_tree (span_node "(all allocations)" root)) 61 + Console.Tree.to_string 62 + (Console.Tree.of_tree (span_node "(all allocations)" root)) 60 63 61 64 let run_tree file = 62 65 let r = R.open_ ~filename:file in
+1 -1
bin/obs/dune
··· 10 10 observer_fxt 11 11 observe_memtrace 12 12 nox-json 13 - nox-tty 13 + console 14 14 sqlite 15 15 runtime_events 16 16 eio
+1 -1
dune-project
··· 69 69 (eio (>= 1.0)) 70 70 (eio_main (>= 1.0)) 71 71 vsock 72 - nox-tty 72 + console 73 73 (monitor :with-test) 74 74 (alcotest :with-test)))
+1 -1
obs.opam
··· 30 30 "eio" {>= "1.0"} 31 31 "eio_main" {>= "1.0"} 32 32 "vsock" 33 - "nox-tty" 33 + "console" 34 34 "monitor" {with-test} 35 35 "alcotest" {with-test} 36 36 "odoc" {with-doc}