From 3352ed0a6b3748b38ba5f4f308d88bf9a37c15df Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Tue, 28 Feb 2017 21:31:31 -0800 Subject: [PATCH] [infer][backend] remove the call stats from the summary Summary: This seems to only be used for stats and for the concept of call rank that is not used right now Reviewed By: cristianoc Differential Revision: D4624681 fbshipit-source-id: 7406496 --- infer/src/backend/InferPrint.re | 22 ---------------------- infer/src/backend/callbacks.ml | 2 +- infer/src/backend/interproc.ml | 2 +- infer/src/backend/ondemand.ml | 6 +----- infer/src/backend/specs.ml | 17 +++++------------ infer/src/backend/specs.mli | 4 +--- 6 files changed, 9 insertions(+), 44 deletions(-) diff --git a/infer/src/backend/InferPrint.re b/infer/src/backend/InferPrint.re index d3f7abec8..24a8b00ad 100644 --- a/infer/src/backend/InferPrint.re +++ b/infer/src/backend/InferPrint.re @@ -137,9 +137,6 @@ type summary_val = { vsignature: string, vweight: int, vproof_coverage: string, - vrank: string, - vin_calls: int, - vout_calls: int, vproof_trace: string }; @@ -174,16 +171,6 @@ let summary_values summary => { } else { float_of_int nr_nodes_visited /. float_of_int nodes_nr }; - let logscale x => log10 (float_of_int (x + 1)); - let (in_calls, out_calls) = { - let calls = stats.Specs.stats_calls; - (calls.Cg.in_calls, calls.Cg.out_calls) - }; - let call_rank = { - let c1 = 1 - and c2 = 1; - logscale (c1 * in_calls + c2 * out_calls) - }; let pp_failure failure => F.asprintf "%a" SymOp.pp_failure_kind failure; { vname: Procname.to_string proc_name, @@ -205,9 +192,6 @@ let summary_values summary => { vsignature: signature, vweight: nodes_nr, vproof_coverage: Printf.sprintf "%2.2f" node_coverage, - vrank: Printf.sprintf "%2.2f" call_rank, - vin_calls: in_calls, - vout_calls: out_calls, vproof_trace: proof_trace } }; @@ -254,9 +238,6 @@ let module ProcsCsv = { pp "\"%s\"," (Escape.escape_csv sv.vsignature); pp "%d," sv.vweight; pp "%s," sv.vproof_coverage; - pp "%s," sv.vrank; - pp "%d," sv.vin_calls; - pp "%d," sv.vout_calls; pp "%s@\n" sv.vproof_trace }; }; @@ -284,9 +265,6 @@ let module ProcsXml = { subtree Io_infer.Xml.tag_signature (Escape.escape_xml sv.vsignature), subtree Io_infer.Xml.tag_weight (string_of_int sv.vweight), subtree Io_infer.Xml.tag_proof_coverage sv.vproof_coverage, - subtree Io_infer.Xml.tag_rank sv.vrank, - subtree Io_infer.Xml.tag_in_calls (string_of_int sv.vin_calls), - subtree Io_infer.Xml.tag_out_calls (string_of_int sv.vin_calls), subtree Io_infer.Xml.tag_proof_trace sv.vproof_trace, subtree Io_infer.Xml.tag_flags (string_of_int (Hashtbl.length sv.vflags)) ]; diff --git a/infer/src/backend/callbacks.ml b/infer/src/backend/callbacks.ml index 8f8896816..cab98f8a1 100644 --- a/infer/src/backend/callbacks.ml +++ b/infer/src/backend/callbacks.ml @@ -164,7 +164,7 @@ let iterate_callbacks call_graph exe_env = let should_reset = is_none (Specs.get_summary proc_name) in if should_reset - then Specs.reset_summary call_graph proc_name attributes_opt None in + then Specs.reset_summary proc_name attributes_opt None in (* Make sure summaries exists. *) List.iter ~f:reset_summary procs_to_analyze; diff --git a/infer/src/backend/interproc.ml b/infer/src/backend/interproc.ml index 54ace86ed..285bad5d2 100644 --- a/infer/src/backend/interproc.ml +++ b/infer/src/backend/interproc.ml @@ -1428,7 +1428,7 @@ let do_analysis exe_env = if Config.dynamic_dispatch = `Lazy then Some pdesc else None in - Specs.init_summary (nodes, proc_flags, calls, None, attributes, proc_desc_option) in + Specs.init_summary (nodes, proc_flags, calls, attributes, proc_desc_option) in List.iter ~f:(fun (pn, _) -> diff --git a/infer/src/backend/ondemand.ml b/infer/src/backend/ondemand.ml index e75b1a744..311094d39 100644 --- a/infer/src/backend/ondemand.ml +++ b/infer/src/backend/ondemand.ml @@ -133,15 +133,11 @@ let run_proc_analysis ~propagate_exceptions analyze_proc curr_pdesc callee_pdesc attributes.loc.file) ~default:SourceFile.empty attributes_opt in - let call_graph = - let cg = Cg.create (Some source) in - Cg.add_defined_node cg callee_pname; - cg in let callee_pdesc_option = if Config.dynamic_dispatch = `Lazy then Some callee_pdesc else None in - Specs.reset_summary call_graph callee_pname attributes_opt callee_pdesc_option; + Specs.reset_summary callee_pname attributes_opt callee_pdesc_option; Specs.set_status callee_pname Specs.Active; source in diff --git a/infer/src/backend/specs.ml b/infer/src/backend/specs.ml index a1f34ba35..117a266ac 100644 --- a/infer/src/backend/specs.ml +++ b/infer/src/backend/specs.ml @@ -298,7 +298,6 @@ type stats = { stats_time: float; (** Analysis time for the procedure *) stats_failure: SymOp.failure_kind option; (** what type of failure stopped the analysis (if any) *) - stats_calls: Cg.in_out_calls; (** num of procs calling, and called *) symops: int; (** Number of SymOp's throughout the whole analysis of the function *) mutable nodes_visited_fp : IntSet.t; (** Nodes visited during the footprint phase *) mutable nodes_visited_re : IntSet.t; (** Nodes visited during the re-execution phase *) @@ -368,9 +367,8 @@ let pp_errlog fmt err_log = F.fprintf fmt "WARNINGS: @[%a@]" Errlog.pp_warnings err_log let pp_stats whole_seconds fmt stats = - F.fprintf fmt "TIME:%a FAILURE:%a SYMOPS:%d CALLS:%d,%d@\n" (pp_time whole_seconds) + F.fprintf fmt "TIME:%a FAILURE:%a SYMOPS:%d@\n" (pp_time whole_seconds) stats.stats_time pp_failure_kind_opt stats.stats_failure stats.symops - stats.stats_calls.Cg.in_calls stats.stats_calls.Cg.out_calls (** Print the spec *) @@ -494,13 +492,9 @@ let pp_summary_html ~whole_seconds source color fmt summary = pp_specs pe fmt (get_specs_from_payload summary); F.fprintf fmt "@\n" -let empty_stats calls in_out_calls_opt = +let empty_stats calls = { stats_time = 0.0; stats_failure = None; - stats_calls = - (match in_out_calls_opt with - | Some in_out_calls -> in_out_calls - | None -> { Cg.in_calls = 0; Cg.out_calls = 0 }); symops = 0; nodes_visited_fp = IntSet.empty; nodes_visited_re = IntSet.empty; @@ -731,7 +725,7 @@ let empty_payload = initializes the summary for [proc_name] given dependent procs in list [depend_list]. *) let init_summary (nodes, - proc_flags, calls, in_out_calls_opt, + proc_flags, calls, proc_attributes, proc_desc_option) = let summary = @@ -740,7 +734,7 @@ let init_summary phase = FOOTPRINT; sessions = ref 0; payload = empty_payload; - stats = empty_stats calls in_out_calls_opt; + stats = empty_stats calls; status = Initialized; attributes = { proc_attributes with @@ -750,7 +744,7 @@ let init_summary Procname.Hash.replace spec_tbl proc_attributes.ProcAttributes.proc_name summary (** Reset a summary rebuilding the dependents and preserving the proc attributes if present. *) -let reset_summary call_graph proc_name attributes_opt proc_desc_option = +let reset_summary proc_name attributes_opt proc_desc_option = let proc_attributes = match attributes_opt with | Some attributes -> attributes @@ -760,7 +754,6 @@ let reset_summary call_graph proc_name attributes_opt proc_desc_option = [], ProcAttributes.proc_flags_empty (), [], - Some (Cg.get_calls call_graph proc_name), proc_attributes, proc_desc_option ) diff --git a/infer/src/backend/specs.mli b/infer/src/backend/specs.mli index 02768f6ad..f67aecf99 100644 --- a/infer/src/backend/specs.mli +++ b/infer/src/backend/specs.mli @@ -108,7 +108,6 @@ type stats = { stats_time: float; (** Analysis time for the procedure *) stats_failure: SymOp.failure_kind option; (** what type of failure stopped the analysis (if any) *) - stats_calls: Cg.in_out_calls; (** num of procs calling, and called *) symops: int; (** Number of SymOp's throughout the whole analysis of the function *) mutable nodes_visited_fp : IntSet.t; (** Nodes visited during the footprint phase *) mutable nodes_visited_re : IntSet.t; (** Nodes visited during the re-execution phase *) @@ -219,13 +218,12 @@ val init_summary : ( Procdesc.Node.id list * (* nodes *) ProcAttributes.proc_flags * (* procedure flags *) (Procname.t * Location.t) list * (* calls *) - (Cg.in_out_calls option) * (* in and out calls *) ProcAttributes.t * (* attributes of the procedure *) Procdesc.t option) (* procdesc option *) -> unit (** Reset a summary rebuilding the dependents and preserving the proc attributes if present. *) -val reset_summary : Cg.t -> Procname.t -> ProcAttributes.t option -> Procdesc.t option -> unit +val reset_summary : Procname.t -> ProcAttributes.t option -> Procdesc.t option -> unit (** Load procedure summary from the given file *) val load_summary : DB.filename -> summary option