[reporting][perf] report total frontend and total backend time perf stats

Summary:
- Time only stats are now reported from the driver for
	- TotalFrontend
	- TotalBackend

Reviewed By: dulmarod

Differential Revision: D7382161

fbshipit-source-id: 6e34ca2
master
Varun Arora 7 years ago committed by Facebook Github Bot
parent 00744a888a
commit 07b0703513

@ -37,7 +37,9 @@ type stats_type =
| ClangFrontendLinters of SourceFile.t | ClangFrontendLinters of SourceFile.t
| JavaFrontend of SourceFile.t | JavaFrontend of SourceFile.t
| PythonFrontend of SourceFile.t | PythonFrontend of SourceFile.t
| TotalFrontend
| Backend of SourceFile.t | Backend of SourceFile.t
| TotalBackend
| Reporting | Reporting
| Driver | Driver
@ -76,8 +78,12 @@ let relative_path_of_stats_type stats_type =
Config.frontend_stats_dir_name Config.frontend_stats_dir_name
| PythonFrontend _ -> | PythonFrontend _ ->
Config.frontend_stats_dir_name Config.frontend_stats_dir_name
| TotalFrontend ->
Config.frontend_stats_dir_name
| Backend _ -> | Backend _ ->
Config.backend_stats_dir_name Config.backend_stats_dir_name
| TotalBackend ->
Config.backend_stats_dir_name
| Reporting -> | Reporting ->
Config.reporting_stats_dir_name Config.reporting_stats_dir_name
| Driver -> | Driver ->
@ -97,8 +103,12 @@ let string_of_stats_type = function
"java_frontend" "java_frontend"
| PythonFrontend _ -> | PythonFrontend _ ->
"python_frontend" "python_frontend"
| TotalFrontend ->
"total_frontend"
| Backend _ -> | Backend _ ->
"backend" "backend"
| TotalBackend ->
"total_backend"
| Reporting -> | Reporting ->
"reporting" "reporting"
| Driver -> | Driver ->

@ -21,7 +21,9 @@ type stats_type =
| ClangFrontendLinters of SourceFile.t | ClangFrontendLinters of SourceFile.t
| JavaFrontend of SourceFile.t | JavaFrontend of SourceFile.t
| PythonFrontend of SourceFile.t | PythonFrontend of SourceFile.t
| TotalFrontend
| Backend of SourceFile.t | Backend of SourceFile.t
| TotalBackend
| Reporting | Reporting
| Driver | Driver

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

@ -63,8 +63,12 @@ let gen_previous_driver_mode script =
let diff driver_mode = let diff driver_mode =
Driver.run_prologue driver_mode ; Driver.run_prologue driver_mode ;
let changed_files = Driver.read_config_changed_files () in let changed_files = Driver.read_config_changed_files () in
Driver.register_perf_stats_report PerfStats.TotalFrontend ;
Driver.capture driver_mode ~changed_files ; 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 ; 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 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. *) (* 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 () ; ResultsDir.delete_capture_and_analysis_data () ;
@ -75,8 +79,12 @@ let diff driver_mode =
Option.value_map ~default:driver_mode ~f:gen_previous_driver_mode Option.value_map ~default:driver_mode ~f:gen_previous_driver_mode
Config.gen_previous_build_command_script Config.gen_previous_build_command_script
in in
Driver.register_perf_stats_report PerfStats.TotalFrontend ;
Driver.capture previous_driver_mode ~changed_files ; 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 ; Driver.analyze_and_report ~suppress_console_report:true previous_driver_mode ~changed_files ;
PerfStats.get_reporter PerfStats.TotalBackend () ;
checkout Current ; checkout Current ;
let previous_report = Some (save_report Previous) in let previous_report = Some (save_report Previous) in
(* compute differential *) (* compute differential *)

@ -528,6 +528,11 @@ let mode_from_command_line =
mode_of_build_command (List.rev Config.rest) ) 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 = let run_prologue mode =
if CLOpt.is_originator then ( if CLOpt.is_originator then (
L.environment_info "%a@\n" Config.pp_version () ; L.environment_info "%a@\n" Config.pp_version () ;

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

Loading…
Cancel
Save