Skip to content

Commit

Permalink
Upgrade to OCaml 4.14.0
Browse files Browse the repository at this point in the history
Signed-off-by: Tudor Brindus <[email protected]>
  • Loading branch information
Xyene committed Feb 17, 2024
1 parent 9846bd7 commit 9c9ee06
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-latest
ocaml-version:
- 4.13.1
- 4.14.0

runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion core/elf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ let all_symbols ?(select = `File_or_func) t =
symbol tables. *)
(match Hashtbl.add res ~key:name ~data:symbol with
| `Ok | `Duplicate -> ())));
String.Table.to_alist res
Hashtbl.to_alist res
;;

let all_file_selections t symbol =
Expand Down
4 changes: 2 additions & 2 deletions core/perf_map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ module Table = struct
;;

let load_by_files files =
Deferred.List.map files ~f:(fun filename ->
Deferred.List.map files ~how:`Sequential ~f:(fun filename ->
load filename |> Deferred.map ~f:(fun map -> pid_of_filename filename, map))
>>| create
;;

let load_by_pids pids =
Deferred.List.map pids ~f:(fun pid ->
Deferred.List.map pids ~how:`Sequential ~f:(fun pid ->
load (default_filename ~pid) |> Deferred.map ~f:(fun map -> pid, map))
>>| create
;;
Expand Down
2 changes: 1 addition & 1 deletion magic-trace.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.12"}
"ocaml" {>= "4.14"}
"async"
"cohttp"
"cohttp_static_handler"
Expand Down
2 changes: 1 addition & 1 deletion src/for_range.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end
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
Expand Down
4 changes: 2 additions & 2 deletions src/perf_tool_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ module Recording = struct
Sys.readdir record_dir
|> Deferred.bind
~f:
(Deferred.Array.iter ~f:(fun file ->
(Deferred.Array.iter ~how:`Sequential ~f:(fun file ->
if String.is_prefix file ~prefix:"perf.data"
then Sys.remove (record_dir ^/ file)
else Deferred.return ()))
Expand Down Expand Up @@ -482,7 +482,7 @@ let decode_events
>>| List.filter ~f:(String.is_prefix ~prefix:"perf.data")
in
let%map result =
Deferred.List.map files ~f:(fun perf_data_file ->
Deferred.List.map files ~how:`Sequential ~f:(fun perf_data_file ->
let itrace_opts =
match collection_mode with
| Intel_processor_trace _ -> [ "--itrace=bep" ]
Expand Down
2 changes: 1 addition & 1 deletion src/trace.ml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ let write_trace_from_events
Trace_writer.write_event writer ?events_writer ev
in
let%bind () =
Deferred.List.iteri events ~f:(fun index events ->
Deferred.List.iteri events ~how:`Sequential ~f:(fun index events ->
Pipe.iter_without_pushback events ~f:(process_event index))
in
(match events_writer with
Expand Down
22 changes: 11 additions & 11 deletions vendor/tracing/src/parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ let lookup_string_exn t ~index =
if index = 0
then ""
else (
try Int.Table.find_exn t.string_table index with
try Hashtbl.find_exn t.string_table index with
| _ -> raise String_not_found)
;;

let lookup_thread_exn t ~index =
try Int.Table.find_exn t.thread_table index with
try Hashtbl.find_exn t.thread_table index with
| _ -> raise Thread_not_found
;;

Expand Down Expand Up @@ -216,7 +216,7 @@ let parse_metadata_record t =
let provider_name =
consume_tail_padded_string_exn t.cur_record ~len:(name_len + padding)
in
Int.Table.set t.provider_name_by_id ~key:provider_id ~data:provider_name;
Hashtbl.set t.provider_name_by_id ~key:provider_id ~data:provider_name;
t.current_provider <- Some provider_id
| 2 (* Provider section metadata *) ->
let provider_id = extract_field header ~pos:20 ~size:32 in
Expand Down Expand Up @@ -268,7 +268,7 @@ let parse_string_record t =
let interned_string =
consume_tail_padded_string_exn t.cur_record ~len:(str_len + padding)
in
Int.Table.set t.string_table ~key:string_index ~data:interned_string;
Hashtbl.set t.string_table ~key:string_index ~data:interned_string;
Some (Record.Interned_string { index = string_index; value = interned_string }))
;;

Expand All @@ -286,12 +286,12 @@ let parse_thread_record t =
let thread =
{ Thread.pid = process_koid
; tid = thread_koid
; process_name = Int.Table.find t.process_names process_koid
; process_name = Hashtbl.find t.process_names process_koid
; thread_name =
Thread_kernel_object.Table.find t.thread_names (process_koid, thread_koid)
Hashtbl.find t.thread_names (process_koid, thread_koid)
}
in
Int.Table.set t.thread_table ~key:thread_index ~data:thread;
Hashtbl.set t.thread_table ~key:thread_index ~data:thread;
Some (Record.Interned_thread { index = thread_index; value = thread }))
;;

Expand Down Expand Up @@ -348,9 +348,9 @@ let parse_kernel_object_record t =
match obj_type with
| 1 (* process *) ->
let koid = consume_int64_trunc_exn t.cur_record in
Int.Table.set t.process_names ~key:koid ~data:name_str;
Hashtbl.set t.process_names ~key:koid ~data:name_str;
(* Update the name of any matching process in the process table. *)
Int.Table.iter t.thread_table ~f:(fun thread ->
Hashtbl.iter t.thread_table ~f:(fun thread ->
if thread.pid = koid then thread.process_name <- Some name_str);
if num_args > 0
then t.warnings.num_unparsed_args <- t.warnings.num_unparsed_args + num_args;
Expand All @@ -368,12 +368,12 @@ let parse_kernel_object_record t =
then (
consume_int32_exn t.cur_record |> (ignore : int -> unit);
let process_koid = consume_int64_trunc_exn t.cur_record in
Thread_kernel_object.Table.set
Hashtbl.set
t.thread_names
~key:(process_koid, koid)
~data:name_str;
(* Update the name of any matching thread in the thread table. *)
Int.Table.iter t.thread_table ~f:(fun thread ->
Hashtbl.iter t.thread_table ~f:(fun thread ->
if thread.pid = process_koid && thread.tid = koid
then thread.thread_name <- Some name_str);
(* Mark any remaining arguments as unparsed. *)
Expand Down

0 comments on commit 9c9ee06

Please sign in to comment.