janestreet / magic-trace

magic-trace collects and displays high-resolution traces of what a process is doing
https://magic-trace.org
MIT License
4.58k stars 87 forks source link

make it possible to invoke `magic-trace run -- prog args` #292

Closed v-gb closed 7 months ago

v-gb commented 7 months ago

instead of magic-trace run prog -- args.

The current CLI is annoying because you can't just prefix the command line with magic-trace run, you have to insert of -- in between the prog and the args.

I didn't actually run the result, because I get a number of type errors. I fixed enough to know my code types but not everything. Example of what I had to fix:

diff --git a/src/for_range.ml b/src/for_range.ml
index 5ddf0b0fff...4181efe477 100644
--- a/src/for_range.ml
+++ b/src/for_range.ml
@@ -21,7 +21,7 @@
 let range_hit_times ~decode_events ~range_symbols =
   let open Deferred.Or_error.Let_syntax in
   let%bind { Decode_result.events; _ } = decode_events () in
-  Deferred.List.map events ~f:(fun events ->
+  Deferred.List.map events ~how:`Sequential ~f:(fun events ->
     let { Trace_filter.start_symbol; stop_symbol } = range_symbols in
     let is_start symbol = String.(Symbol.display_name symbol = start_symbol) in
     let is_stop symbol = String.(Symbol.display_name symbol = stop_symbol) in
Xyene commented 7 months ago

https://github.com/janestreet/magic-trace/pull/294