12345678910111213141516171819202122232425262728293031323334353637(** 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!Coreopen!AsyncmoduleServe=structtypet=unitletparam=let%map_open.Command()=return()in();;letcreate~port:_~open_in_browser:_=()letserve_file_t~path:_=failwith"Serving a Perfetto UI is a Jane Street internal feature.";;endtypet={store_path:string}letparam=let%map_open.Commandstore_path=flag"output"(requiredstring)~doc:"FILE output file name"in{store_path};;letwrite_and_view?num_temp_strs{store_path}~default_name:_~f=letopenDeferred.Or_error.Let_syntaxinletw=Tracing_destinations_unix.file_writer?num_temp_strs~filename:store_path()inlet%mapres=fwinCore.eprintf"Visit https://ui.perfetto.dev/ and open %s to view trace.\n%!"store_path;res;;