Skip to content

Commit

Permalink
more tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jan 8, 2024
1 parent f9c48e3 commit c7b6f5e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ let display_error (n, error) =

module Json = struct
let output_request request user_action =
OpamTrace.with_span "Solution.Json.output_request" @@ fun () ->
if OpamClientConfig.(!r.json_out = None) then () else
let atoms =
List.map (fun a -> `String (OpamFormula.short_string_of_atom a))
Expand All @@ -264,6 +265,7 @@ module Json = struct
OpamJson.append "request" j

let output_solution t solution =
OpamTrace.with_span "Solution.Json.output_solution" @@ fun () ->
if OpamClientConfig.(!r.json_out = None) then () else
match solution with
| Success solution ->
Expand Down
3 changes: 3 additions & 0 deletions src/solver/opamCudf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,7 @@ let call_external_solver ~version_map univ req =
Dose_algo.Depsolver.Sat(None,Cudf.load_universe [])

let check_request ?(explain=true) ~version_map univ req =
OpamTrace.with_span "Cudf.check_request" @@ fun () ->
let chrono = OpamConsole.timer () in
log "Checking request...";
let result = Dose_algo.Depsolver.check_request ~explain (to_cudf univ req) in
Expand All @@ -1546,6 +1547,7 @@ let check_request ?(explain=true) ~version_map univ req =

(* Return the universe in which the system has to go *)
let get_final_universe ~version_map univ req =
OpamTrace.with_span "Cudf.get_final_universe" @@ fun () ->
let fail msg =
let f = dump_cudf_error ~version_map univ req in
let msg =
Expand Down Expand Up @@ -1593,6 +1595,7 @@ let actions_of_diff (install, remove) =
actions

let resolve ~extern ~version_map universe request =
OpamTrace.with_span "Cudf.resolve" @@ fun () ->
log "resolve request=%a" (slog string_of_request) request;
let resp =
let check () = check_request ~version_map universe request in
Expand Down
4 changes: 4 additions & 0 deletions src/solver/opamSolver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ let opam2cudf_set universe version_map packages =
OpamCudf.Set.empty

let load_cudf_packages opam_universe ?version_map opam_packages =
OpamTrace.with_span "Solver.load_cudf_packages" @@ fun () ->
let chrono = OpamConsole.timer () in
let version_map = match version_map with
| Some vm -> vm
Expand Down Expand Up @@ -367,6 +368,7 @@ let map_to_cudf_universe cudf_packages_map =

(* load a cudf universe from an opam one *)
let load_cudf_universe opam_universe ?version_map opam_packages =
OpamTrace.with_span "Solver.load_cudf_universe" @@ fun () ->
let load_f = load_cudf_packages opam_universe ?version_map opam_packages in
fun ?add_invariant ?depopts ~build ~post () ->
log "Load cudf universe (depopts:%a, build:%b, post:%b)"
Expand Down Expand Up @@ -436,6 +438,7 @@ let cycle_conflict ~version_map univ cycles =
OpamCudf.cycle_conflict ~version_map univ cycles

let resolve universe request =
OpamTrace.with_span "Solver.resolve" @@ fun () ->
log "resolve request=%a" (slog string_of_request) request;
let all_packages = universe.u_available ++ universe.u_installed in
let version_map = cudf_versions_map universe in
Expand Down Expand Up @@ -464,6 +467,7 @@ let resolve universe request =
opam_invariant_package version_map universe.u_invariant
in
let solution =
OpamTrace.with_span "Solver.resolve.solution" @@ fun () ->
try
Cudf.add_package cudf_universe invariant_pkg;
Cudf.add_package cudf_universe deprequest_pkg;
Expand Down
1 change: 1 addition & 0 deletions src/state/opamSwitchState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ let universe st
?reinstall
~requested
user_action =
OpamTrace.with_span "SwitchState.universe" @@ fun () ->
let chrono = OpamConsole.timer () in
let names = OpamPackage.names_of_packages requested in
let requested_allpkgs =
Expand Down

0 comments on commit c7b6f5e

Please sign in to comment.