[reporting] fix reporting of total_frontend and total_backend stats

Reviewed By: dulmarod

Differential Revision: D7417086

fbshipit-source-id: f4ac596
master
Varun Arora 7 years ago committed by Facebook Github Bot
parent 872daf1ba7
commit fda0871030

@ -20,12 +20,8 @@ let run driver_mode =
let open Driver in
run_prologue driver_mode ;
let changed_files = read_config_changed_files () in
register_perf_stats_report PerfStats.TotalFrontend ;
capture driver_mode ~changed_files ;
PerfStats.get_reporter PerfStats.TotalFrontend () ;
register_perf_stats_report PerfStats.TotalBackend ;
analyze_and_report driver_mode ~changed_files ;
PerfStats.get_reporter PerfStats.TotalBackend () ;
run_epilogue driver_mode
@ -132,9 +128,7 @@ let () =
F.fprintf fmt "of cluster %s" (Filename.basename cluster)
in
L.environment_info "Starting analysis %a" pp_cluster_opt Config.cluster_cmdline ;
Driver.register_perf_stats_report PerfStats.TotalBackend ;
Driver.analyze_and_report Analyze ~changed_files:(Driver.read_config_changed_files ()) ;
PerfStats.get_reporter PerfStats.TotalBackend ()
Driver.analyze_and_report Analyze ~changed_files:(Driver.read_config_changed_files ())
| Report ->
InferPrint.main ~report_json:None
| ReportDiff ->

@ -63,12 +63,8 @@ let gen_previous_driver_mode script =
let diff driver_mode =
Driver.run_prologue driver_mode ;
let changed_files = Driver.read_config_changed_files () in
Driver.register_perf_stats_report PerfStats.TotalFrontend ;
Driver.capture driver_mode ~changed_files ;
PerfStats.get_reporter PerfStats.TotalFrontend () ;
Driver.register_perf_stats_report PerfStats.TotalBackend ;
Driver.analyze_and_report ~suppress_console_report:true driver_mode ~changed_files ;
PerfStats.get_reporter PerfStats.TotalBackend () ;
let current_report = Some (save_report Current) in
(* Some files in the current checkout may be deleted in the old checkout. If we kept the results of the previous capture and analysis around, we would report issues on these files again in the previous checkout, which is wrong. Do not do anything too smart for now and just delete all results from the analysis of the current checkout. *)
ResultsDir.delete_capture_and_analysis_data () ;
@ -79,12 +75,8 @@ let diff driver_mode =
Option.value_map ~default:driver_mode ~f:gen_previous_driver_mode
Config.gen_previous_build_command_script
in
Driver.register_perf_stats_report PerfStats.TotalFrontend ;
Driver.capture previous_driver_mode ~changed_files ;
PerfStats.get_reporter PerfStats.TotalFrontend () ;
Driver.register_perf_stats_report PerfStats.TotalBackend ;
Driver.analyze_and_report ~suppress_console_report:true previous_driver_mode ~changed_files ;
PerfStats.get_reporter PerfStats.TotalBackend () ;
checkout Current ;
let previous_report = Some (save_report Previous) in
(* compute differential *)

@ -62,6 +62,11 @@ let clean_compilation_command mode =
None
let register_perf_stats_report stats_type =
let rtime_span, initial_times = (Mtime_clock.counter (), Unix.times ()) in
PerfStats.register_report (PerfStats.Time (rtime_span, initial_times)) stats_type
(* Clean up the results dir to select only what's relevant to go in the Buck cache. In particular,
get rid of non-deterministic outputs.*)
let clean_results_dir () =
@ -208,6 +213,7 @@ let capture ~changed_files mode =
(* pretend prog is the root directory of the project *)
PythonMain.go args
| PythonCapture (build_system, build_cmd) ->
register_perf_stats_report PerfStats.TotalFrontend ;
L.progress "Capturing in %s mode...@." (Config.string_of_build_system build_system) ;
let in_buck_mode = Config.equal_build_system build_system BBuck in
let infer_py = Config.lib_dir ^/ "python" ^/ "infer.py" in
@ -282,7 +288,8 @@ let capture ~changed_files mode =
Config.print_usage_exit ()
| status ->
command_error_handling ~always_die:true ~prog:infer_py ~args status)
()
() ;
PerfStats.get_reporter PerfStats.TotalFrontend ()
| XcodeXcpretty (prog, args) ->
L.progress "Capturing using xcodebuild and xcpretty...@." ;
check_xcpretty () ;
@ -312,9 +319,11 @@ let run_parallel_analysis ~changed_files : unit =
let execute_analyze ~changed_files =
register_perf_stats_report PerfStats.TotalBackend ;
if Int.equal Config.jobs 1 || Config.cluster_cmdline <> None then
InferAnalyze.main ~changed_files ~makefile:""
else run_parallel_analysis ~changed_files
else run_parallel_analysis ~changed_files ;
PerfStats.get_reporter PerfStats.TotalBackend ()
let report ?(suppress_console= false) () =
@ -528,11 +537,6 @@ let mode_from_command_line =
mode_of_build_command (List.rev Config.rest) )
let register_perf_stats_report stats_type =
let rtime_span, initial_times = (Mtime_clock.counter (), Unix.times ()) in
PerfStats.register_report (PerfStats.Time (rtime_span, initial_times)) stats_type
let run_prologue mode =
if CLOpt.is_originator then (
L.environment_info "%a@\n" Config.pp_version () ;

@ -34,8 +34,6 @@ val mode_from_command_line : mode Lazy.t
val mode_of_build_command : string list -> mode
(** driver mode computed from the build command alone, eg [["buck"; "build"; ...]] gives [PythonCapture (BBuck, ["buck"; "build"; ...])] *)
val register_perf_stats_report : PerfStats.stats_type -> unit
val run_prologue : mode -> unit
(** prepare the environment for running the given mode *)

Loading…
Cancel
Save