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
master
Fernando Gasperi Jabalera 5 years ago committed by Facebook Github Bot
parent b12f1cb09c
commit 83cff5e435

@ -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 (** 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. *) 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 = 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)) |> List.permute ~random_state:(Random.State.make (Array.create ~len:1 0))
|> of_list |> of_list
in in
let next x = let next x =
let res = gen.next x in let res = gen.next x in
(* see defn of gen above to see why res should never match Some (Procname _) *) (* see defn of gen above to see why res should never match Some (File _) *)
match res with None -> None | Some (Procname _) -> assert false | Some (File _) as v -> v match res with None -> None | Some (File _) -> assert false | Some (Procname _) as v -> v
in in
{gen with next} {gen with next}
let make sources =
ProcessPool.TaskGenerator.chain (make_with_procs_from sources) (FileScheduler.make sources)

Loading…
Cancel
Save