[infer][report] fix performance issue when logging events

Reviewed By: dulmarod, jvillard

Differential Revision: D6960795

fbshipit-source-id: c10eca6
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent c514b19786
commit 1d2d6b7976

@ -536,6 +536,7 @@ module Stats = struct
; symops= summary.stats.symops } ; symops= summary.stats.symops }
:: stats.events_to_log :: stats.events_to_log
let num_files stats = Hashtbl.length stats.files let num_files stats = Hashtbl.length stats.files
let pp fmt stats = let pp fmt stats =
@ -1031,7 +1032,7 @@ let finalize_and_close_files format_list_by_kind (stats: Stats.t) =
let outfile = get_outfile outfile_opt in let outfile = get_outfile outfile_opt in
IssuesJson.pp_json_close outfile.fmt () IssuesJson.pp_json_close outfile.fmt ()
| Logs, Stats -> | Logs, Stats ->
EventLogger.log_multiple stats.events_to_log List.iter ~f:EventLogger.log stats.events_to_log
| Csv, (Issues | Procs | Calls | Summary) | Csv, (Issues | Procs | Calls | Summary)
| Logs, (Issues | Procs | Calls | Summary) | Logs, (Issues | Procs | Calls | Summary)
| Json, (Procs | Stats | Calls | Summary) | Json, (Procs | Stats | Calls | Summary)

@ -220,12 +220,4 @@ let prepare = IO.prepare
let log event = IO.write "%s\n" (create_row event) let log event = IO.write "%s\n" (create_row event)
let log_multiple events =
let rows = List.map ~f:create_row events in
let combinedJson =
List.fold_right rows ~init:"" ~f:(fun row combined -> combined ^ row ^ "\n")
in
IO.write "%s" combinedJson
let dump = IO.dump let dump = IO.dump

@ -45,6 +45,4 @@ val prepare : unit -> unit
val log : event -> unit val log : event -> unit
val log_multiple : event list -> unit
val dump : unit -> unit val dump : unit -> unit

Loading…
Cancel
Save