diff --git a/infer/src/backend/TaskScheduler.ml b/infer/src/backend/FileScheduler.ml similarity index 73% rename from infer/src/backend/TaskScheduler.ml rename to infer/src/backend/FileScheduler.ml index c314e93dd..845448cad 100644 --- a/infer/src/backend/TaskScheduler.ml +++ b/infer/src/backend/FileScheduler.ml @@ -6,7 +6,7 @@ *) open! IStd -let of_sources sources = +let make sources = let open SchedulerTypes in let gen = List.rev_map sources ~f:(fun sf -> File sf) @@ -18,9 +18,3 @@ let of_sources sources = match res with None -> None | Some (Procname _) -> assert false | Some (File _) as v -> v in {gen with next} - - -let schedule sources = - if Config.call_graph_schedule then - ProcessPool.TaskGenerator.chain (SyntacticCallGraph.bottom_up sources) (of_sources sources) - else of_sources sources diff --git a/infer/src/backend/TaskScheduler.mli b/infer/src/backend/FileScheduler.mli similarity index 69% rename from infer/src/backend/TaskScheduler.mli rename to infer/src/backend/FileScheduler.mli index e0ebe4e14..d4b8fc626 100644 --- a/infer/src/backend/TaskScheduler.mli +++ b/infer/src/backend/FileScheduler.mli @@ -6,4 +6,4 @@ *) open! IStd -val schedule : SourceFile.t list -> SchedulerTypes.target ProcessPool.TaskGenerator.t +val make : SourceFile.t list -> SchedulerTypes.target ProcessPool.TaskGenerator.t diff --git a/infer/src/backend/InferAnalyze.ml b/infer/src/backend/InferAnalyze.ml index 41a68b43d..bb055f2d1 100644 --- a/infer/src/backend/InferAnalyze.ml +++ b/infer/src/backend/InferAnalyze.ml @@ -112,6 +112,14 @@ let get_source_files_to_analyze ~changed_files = source_files_to_analyze +let schedule sources = + if Config.call_graph_schedule then + ProcessPool.TaskGenerator.chain + (SyntacticCallGraph.bottom_up sources) + (FileScheduler.make sources) + else FileScheduler.make sources + + let analyze source_files_to_analyze = if Int.equal Config.jobs 1 then ( let target_files = List.rev_map source_files_to_analyze ~f:(fun sf -> SchedulerTypes.File sf) in @@ -119,7 +127,7 @@ let analyze source_files_to_analyze = BackendStats.get () ) else ( L.environment_info "Parallel jobs: %d@." Config.jobs ; - let tasks = TaskScheduler.schedule source_files_to_analyze in + let tasks = schedule source_files_to_analyze in (* Prepare tasks one cluster at a time while executing in parallel *) let runner = Tasks.Runner.create ~jobs:Config.jobs ~f:analyze_target ~child_epilogue:BackendStats.get