@@ -290,8 +290,15 @@ module Context = struct
290290 | Found p -> Some p)
291291 ;;
292292
293- let repo_candidate t name =
294- let versions = Opam_repo. all_packages_versions_map t.repos name in
293+ let repo_candidate t package_name =
294+ let open Dune_stats.Fiber.O in
295+ let & () =
296+ { Dune_stats. name = " repo_candidate"
297+ ; cat = [ " solver" ]
298+ ; args = [ " package" , `String (OpamPackage.Name. to_string package_name) ]
299+ }
300+ in
301+ let versions = Opam_repo. all_packages_versions_map t.repos package_name in
295302 let rejected, available =
296303 OpamPackage.Version.Map. fold
297304 (fun version (repo , key ) (rejected , available ) ->
@@ -305,7 +312,7 @@ module Context = struct
305312 let + resolved = Opam_repo. load_all_versions_by_keys available in
306313 Table. add_exn
307314 t.expanded_packages
308- (Package_name. of_opam_package_name name )
315+ (Package_name. of_opam_package_name package_name )
309316 (OpamPackage.Version.Map. cardinal resolved);
310317 let available =
311318 OpamPackage.Version.Map. values resolved
@@ -786,6 +793,11 @@ module Solver = struct
786793 (* Starting from [root_req], explore all the feeds and implementations we
787794 might need, adding all of them to [sat_problem]. *)
788795 let build_problem context root_req sat ~max_avoids ~dummy_impl =
796+ let event =
797+ Dune_stats. (
798+ start (global () ) (fun () ->
799+ { cat = [ " solver" ]; name = " build_problem" ; args = [] }))
800+ in
789801 (* For each (iface, source) we have a list of implementations. *)
790802 let impl_cache = Fiber_cache. create (module Input. Role ) in
791803 let conflict_classes = Conflict_classes. create () in
@@ -875,6 +887,7 @@ module Solver = struct
875887 process_dep `No_expand impl_var dep)
876888 (* All impl_candidates have now been added, so snapshot the cache. *)
877889 in
890+ Dune_stats. finish event;
878891 Conflict_classes. seal conflict_classes;
879892 (match max_avoids, ! avoids with
880893 | None , _ | _ , [] -> ()
@@ -955,6 +968,10 @@ module Solver = struct
955968 ;;
956969
957970 let do_solve context ~closest_match root_req =
971+ let open Dune_stats.Fiber.O in
972+ let & () =
973+ { Dune_stats. name = " do_solve_with_retries" ; cat = [ " solver" ]; args = [] }
974+ in
958975 do_solve context ~closest_match ~max_avoids: (Some 0 ) root_req
959976 >> = function
960977 | Some sels ->
@@ -1436,13 +1453,20 @@ module Solver = struct
14361453end
14371454
14381455let solve_package_list packages ~context =
1456+ let open Dune_stats.Fiber.O in
1457+ let & () =
1458+ { Dune_stats. name = " solve_package_list"
1459+ ; cat = [ " solver" ]
1460+ ; args = [ " package_count" , `Int (List. length packages) ]
1461+ }
1462+ in
14391463 Fiber. collect_errors (fun () ->
14401464 (* [Solver.solve] returns [Error] when it's unable to find a solution to
1441- the dependencies, but can also raise exceptions, for example if opam
1442- is unable to parse an opam file in the package repository. To prevent
1443- an unexpected opam exception from crashing dune, we catch all
1444- exceptions raised by the solver and report them as [User_error]s
1445- instead. *)
1465+ the dependencies, but can also raise exceptions, for example if opam
1466+ is unable to parse an opam file in the package repository. To prevent
1467+ an unexpected opam exception from crashing dune, we catch all
1468+ exceptions raised by the solver and report them as [User_error]s
1469+ instead. *)
14461470 Solver. solve context packages)
14471471 >> | (function
14481472 | Ok (Ok res ) -> Ok res
0 commit comments