[scheduler][restart] Add Files to the work queue

Summary: Add files and procedures to the `RestartScheduler`'s work queue. This makes the chaining with the FileScheduler unnecessary so it's removed.

Reviewed By: ngorogiannis

Differential Revision: D19942354

fbshipit-source-id: 59e25c1c2
master
Fernando Gasperi Jabalera 5 years ago committed by Facebook Github Bot
parent 100807ed2a
commit b2a2919ce2

@ -17,24 +17,15 @@ let of_list (lst : 'a list) : 'a ProcessPool.TaskGenerator.t =
{remaining_tasks; is_empty; finished; next} {remaining_tasks; is_empty; finished; next}
let make_with_procs_from sources = let make sources =
let gen = let pnames =
List.map sources ~f:SourceFiles.proc_names_of_source List.map sources ~f:SourceFiles.proc_names_of_source
|> List.concat |> List.concat
|> List.rev_map ~f:(fun procname -> SchedulerTypes.Procname procname) |> 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 (File _) *)
match res with None -> None | Some (File _) -> assert false | Some (Procname _) as v -> v
in in
{gen with next} let files = List.map sources ~f:(fun file -> SchedulerTypes.File file) in
let permute = List.permute ~random_state:(Random.State.make (Array.create ~len:1 0)) in
permute pnames @ permute files |> of_list
let make sources =
ProcessPool.TaskGenerator.chain (make_with_procs_from sources) (FileScheduler.make sources)
let if_restart_scheduler f = let if_restart_scheduler f =

@ -373,13 +373,13 @@ let analyze_proc_name_no_caller callee_pname =
let analyze_procedures exe_env procs_to_analyze source_file_opt = let analyze_procedures exe_env procs_to_analyze source_file_opt =
let saved_language = !Language.curr_language in let saved_language = !Language.curr_language in
Option.iter source_file_opt ~f:(fun source_file ->
if Config.dump_duplicate_symbols then dump_duplicate_procs source_file procs_to_analyze ) ;
set_exe_env exe_env ; set_exe_env exe_env ;
let analyze_proc_name_call pname = let analyze_proc_name_call pname =
ignore (analyze_proc_name_no_caller pname : Summary.t option) ignore (analyze_proc_name_no_caller pname : Summary.t option)
in in
List.iter ~f:analyze_proc_name_call procs_to_analyze ; List.iter ~f:analyze_proc_name_call procs_to_analyze ;
Option.iter source_file_opt ~f:(fun source_file ->
if Config.dump_duplicate_symbols then dump_duplicate_procs source_file procs_to_analyze ) ;
Option.iter source_file_opt ~f:(fun source_file -> Option.iter source_file_opt ~f:(fun source_file ->
Callbacks.iterate_cluster_callbacks procs_to_analyze exe_env source_file ; Callbacks.iterate_cluster_callbacks procs_to_analyze exe_env source_file ;
create_perf_stats_report source_file ) ; create_perf_stats_report source_file ) ;

Loading…
Cancel
Save