diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index 7b1200d2e..18123a8cb 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -977,7 +977,7 @@ let main ~report_json = ; (Stats, init_stats_format_list ()) ; (Summary, []) ] in - if Config.developer_mode then register_perf_stats_report () ; + register_perf_stats_report () ; init_files formats_by_report_kind ; match Config.from_json_report with | Some fname -> diff --git a/infer/src/backend/PerfStats.ml b/infer/src/backend/PerfStats.ml index dc1ee7699..cc90b0d51 100644 --- a/infer/src/backend/PerfStats.ml +++ b/infer/src/backend/PerfStats.ml @@ -166,16 +166,18 @@ let report_at_exit file source_file stats_type () = let stats, stats_event = stats source_file stats_type in let json_stats = to_json stats in EventLogger.log stats_event ; - try - Unix.mkdir_p (Filename.dirname file) ; - (* the same report may be registered across different infer processes *) - Utils.write_file_with_locking file ~f:(fun stats_oc -> - Yojson.Basic.pretty_to_channel stats_oc json_stats ) - with exc -> - L.internal_error "Info: failed to write stats to %s@\n%s@\n%s@\n%s@." file - (Exn.to_string exc) - (Yojson.Basic.pretty_to_string json_stats) - (Printexc.get_backtrace ()) + (* We always log to EventLogger, but json files are unnecessary to log outside of developer mode *) + if Config.developer_mode then + try + Unix.mkdir_p (Filename.dirname file) ; + (* the same report may be registered across different infer processes *) + Utils.write_file_with_locking file ~f:(fun stats_oc -> + Yojson.Basic.pretty_to_channel stats_oc json_stats ) + with exc -> + L.internal_error "Info: failed to write stats to %s@\n%s@\n%s@\n%s@." file + (Exn.to_string exc) + (Yojson.Basic.pretty_to_string json_stats) + (Printexc.get_backtrace ()) with exc -> L.internal_error "Info: failed to compute stats for %s@\n%s@\n%s@." file (Exn.to_string exc) (Printexc.get_backtrace ()) diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index a48d685d4..67211980c 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -128,7 +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 ; - if Config.developer_mode then InferAnalyze.register_perf_stats_report () ; + InferAnalyze.register_perf_stats_report () ; Driver.analyze_and_report Analyze ~changed_files:(Driver.read_config_changed_files ()) | Report -> InferPrint.main ~report_json:None diff --git a/infer/src/clang/Capture.ml b/infer/src/clang/Capture.ml index 2aca8ea3e..66c53f860 100644 --- a/infer/src/clang/Capture.ml +++ b/infer/src/clang/Capture.ml @@ -32,8 +32,8 @@ let register_perf_stats_report source_file = let init_global_state_for_capture_and_linters source_file = L.(debug Capture Medium) "Processing %s" (Filename.basename (SourceFile.to_abs_path source_file)) ; - if Config.developer_mode then register_perf_stats_report source_file ; Language.curr_language := Language.Clang ; + register_perf_stats_report source_file ; if Config.capture then DB.Results_dir.init source_file ; CFrontend_config.reset_global_state () diff --git a/infer/src/integration/Driver.ml b/infer/src/integration/Driver.ml index 5822e0f32..3159d7e76 100644 --- a/infer/src/integration/Driver.ml +++ b/infer/src/integration/Driver.ml @@ -542,7 +542,7 @@ let run_prologue mode = anyway, pretend that we are not called from another make to prevent make falling back to a mono-threaded execution. *) Unix.unsetenv "MAKEFLAGS" ; - if Config.developer_mode then register_perf_stats_report () ; + register_perf_stats_report () ; () diff --git a/infer/src/java/jMain.ml b/infer/src/java/jMain.ml index a5f1f1c9e..c27bc82a3 100644 --- a/infer/src/java/jMain.ml +++ b/infer/src/java/jMain.ml @@ -21,8 +21,8 @@ let register_perf_stats_report source_file = let init_global_state source_file = - if Config.developer_mode then register_perf_stats_report source_file ; Language.curr_language := Language.Java ; + register_perf_stats_report source_file ; DB.Results_dir.init source_file ; Ident.NameGenerator.reset () ; JContext.reset_exn_node_table ()