package tracing

  1. Overview
  2. Docs

Source file tracing_tool_output.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(** The Jane Street internal implementation of this module includes functionality to host
    a Perfetto UI from the tool, which relies on some internal infrastructure. *)

open! Core
open! Async

module Serve = struct
  type t = unit

  let param =
    let%map_open.Command () = return () in
    ()
  ;;

  let create ~port:_ ~open_in_browser:_ = ()

  let serve_file _t ~path:_ =
    failwith "Serving a Perfetto UI is a Jane Street internal feature."
  ;;
end

type t = { store_path : string }

let param =
  let%map_open.Command store_path =
    flag "output" (required string) ~doc:"FILE output file name"
  in
  { store_path }
;;

let write_and_view ?num_temp_strs { store_path } ~default_name:_ ~f =
  let open Deferred.Or_error.Let_syntax in
  let w = Tracing_destinations_unix.file_writer ?num_temp_strs ~filename:store_path () in
  let%map res = f w in
  Core.eprintf "Visit https://ui.perfetto.dev/ and open %s to view trace.\n%!" store_path;
  res
;;
OCaml

Innovation. Community. Security.