From 83cff5e435446cce2f038692b5ff4cf7f7e25157 Mon Sep 17 00:00:00 2001 From: Fernando Gasperi Jabalera Date: Thu, 16 Jan 2020 10:05:26 -0800 Subject: [PATCH] Use Procnames as schedule units in the RestartScheduler Summary: The restart scheduler will now have two phases: 1. Analyze all the procs obtained from the sources. 2. Run the FileScheduler on the sources. The second step aims to analyze only the File level analyzers requirements. Reviewed By: ngorogiannis Differential Revision: D19430244 fbshipit-source-id: b4f9ee69b --- infer/src/backend/RestartScheduler.ml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/infer/src/backend/RestartScheduler.ml b/infer/src/backend/RestartScheduler.ml index 9f373f97a..08cb4de44 100644 --- a/infer/src/backend/RestartScheduler.ml +++ b/infer/src/backend/RestartScheduler.ml @@ -18,15 +18,21 @@ let of_list (lst : 'a list) : 'a ProcessPool.TaskGenerator.t = (** This behaves exactly the same as the FileScheduler so far. The goal is that it will use a work queue and proc locking to avoid repeating work and hopefully get some in process cache hits. *) -let make sources = +let make_with_procs_from sources = let gen = - List.rev_map sources ~f:(fun sf -> SchedulerTypes.File sf) + List.map sources ~f:SourceFiles.proc_names_of_source + |> List.concat + |> List.rev_map ~f:(fun procname -> SchedulerTypes.Procname procname) |> List.permute ~random_state:(Random.State.make (Array.create ~len:1 0)) |> of_list in let next x = let res = gen.next x in - (* see defn of gen above to see why res should never match Some (Procname _) *) - match res with None -> None | Some (Procname _) -> assert false | Some (File _) as v -> v + (* see defn of gen above to see why res should never match Some (File _) *) + match res with None -> None | Some (File _) -> assert false | Some (Procname _) as v -> v in {gen with next} + + +let make sources = + ProcessPool.TaskGenerator.chain (make_with_procs_from sources) (FileScheduler.make sources)