[logging] Log unanalyzed procedures

Reviewed By: mbouaziz

Differential Revision: D13083766

fbshipit-source-id: 3e6eb36a4
master
Ezgi Çiçek 6 years ago committed by Facebook Github Bot
parent 9510549cf6
commit a835a3511d

@ -542,6 +542,11 @@ OPTIONS
machine-readable format (Conversely: --no-log-events) machine-readable format (Conversely: --no-log-events)
See also infer-run(1). See also infer-run(1).
--log-skipped
Activates: Turn on the feature that logs skipped functions (one
per file) in a machine-readable format (Conversely:
--no-log-skipped) See also infer-run(1).
--loop-hoisting --loop-hoisting
Activates: checker for loop-hoisting (Conversely: Activates: checker for loop-hoisting (Conversely:
--no-loop-hoisting) See also infer-analyze(1). --no-loop-hoisting) See also infer-analyze(1).

@ -89,6 +89,11 @@ OPTIONS
Activates: Turn on the feature that logs events in a Activates: Turn on the feature that logs events in a
machine-readable format (Conversely: --no-log-events) machine-readable format (Conversely: --no-log-events)
--log-skipped
Activates: Turn on the feature that logs skipped functions (one
per file) in a machine-readable format (Conversely:
--no-log-skipped)
--pmd-xml --pmd-xml
Activates: Output issues in (PMD) XML format (Conversely: Activates: Output issues in (PMD) XML format (Conversely:
--no-pmd-xml) --no-pmd-xml)

@ -542,6 +542,11 @@ OPTIONS
machine-readable format (Conversely: --no-log-events) machine-readable format (Conversely: --no-log-events)
See also infer-run(1). See also infer-run(1).
--log-skipped
Activates: Turn on the feature that logs skipped functions (one
per file) in a machine-readable format (Conversely:
--no-log-skipped) See also infer-run(1).
--loop-hoisting --loop-hoisting
Activates: checker for loop-hoisting (Conversely: Activates: checker for loop-hoisting (Conversely:
--no-loop-hoisting) See also infer-analyze(1). --no-loop-hoisting) See also infer-analyze(1).

@ -291,7 +291,9 @@ let analyze_proc_name ?caller_pdesc callee_pname =
(analyze_proc ?caller_pdesc callee_pdesc, true) (analyze_proc ?caller_pdesc callee_pdesc, true)
| None -> | None ->
(Summary.get callee_pname, true) (Summary.get callee_pname, true)
else (Summary.get callee_pname, true) else (
EventLogger.log_skipped_pname (F.asprintf "%a" Typ.Procname.pp callee_pname) ;
(Summary.get callee_pname, true) )
in in
if update_memcached then memcache_set callee_pname summary_option ; if update_memcached then memcache_set callee_pname summary_option ;
Typ.Procname.Hash.add cache callee_pname summary_option ; Typ.Procname.Hash.add cache callee_pname summary_option ;

@ -1493,6 +1493,12 @@ and log_file =
~default:"logs" "Specify the file to use for logging" ~default:"logs" "Specify the file to use for logging"
and log_skipped =
CLOpt.mk_bool ~long:"log-skipped"
~in_help:InferCommand.[(Run, manual_generic)]
"Turn on the feature that logs skipped functions (one per file) in a machine-readable format"
and perf_profiler_data_file = and perf_profiler_data_file =
CLOpt.mk_path_opt ~long:"perf-profiler-data-file" CLOpt.mk_path_opt ~long:"perf-profiler-data-file"
~in_help:InferCommand.[(Analyze, manual_generic)] ~in_help:InferCommand.[(Analyze, manual_generic)]
@ -2727,6 +2733,8 @@ and log_events = !log_events
and log_file = !log_file and log_file = !log_file
and log_skipped = !log_skipped
and perf_profiler_data_file = !perf_profiler_data_file and perf_profiler_data_file = !perf_profiler_data_file
and loop_hoisting = !loop_hoisting and loop_hoisting = !loop_hoisting

@ -466,6 +466,8 @@ val log_events : bool
val log_file : string val log_file : string
val log_skipped : bool
val perf_profiler_data_file : string option val perf_profiler_data_file : string option
val loop_hoisting : bool val loop_hoisting : bool

@ -38,6 +38,14 @@ module IO = struct
match !out_chan with Some oc -> Printf.fprintf oc fmt | _ -> Printf.ifprintf stdout fmt match !out_chan with Some oc -> Printf.fprintf oc fmt | _ -> Printf.ifprintf stdout fmt
let write_skipped_pname pname =
let fname = events_dir ^/ "skipped_functions" ^ log_file_extension in
let oc = Pervasives.open_out_gen [Open_append; Open_creat] 0o666 fname in
Out_channel.output_string oc pname ;
Out_channel.output_char oc '\n' ;
Out_channel.close oc
let dump () = let dump () =
let dump_file_to_stdout fname = let dump_file_to_stdout fname =
let ic = In_channel.create fname in let ic = In_channel.create fname in
@ -333,6 +341,8 @@ module type S = sig
val log : event -> unit val log : event -> unit
val log_skipped_pname : string -> unit
val dump : unit -> unit val dump : unit -> unit
end end
@ -382,6 +392,8 @@ module LoggerImpl : S = struct
let log event = IO.write "%s\n" (create_row event) let log event = IO.write "%s\n" (create_row event)
let dump = IO.dump let dump = IO.dump
let log_skipped_pname pname = if Config.log_skipped then IO.write_skipped_pname pname else ()
end end
module DummyLogger : S = struct module DummyLogger : S = struct
@ -392,6 +404,8 @@ module DummyLogger : S = struct
let log _ = () let log _ = ()
let dump _ = () let dump _ = ()
let log_skipped_pname _ = ()
end end
(* use real logger if logging is enabled, dummy logger otherwise *) (* use real logger if logging is enabled, dummy logger otherwise *)

@ -98,4 +98,6 @@ val prepare : unit -> unit
val log : event -> unit val log : event -> unit
val log_skipped_pname : string -> unit
val dump : unit -> unit val dump : unit -> unit

Loading…
Cancel
Save