[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
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent 9c52e8ee68
commit 3352ed0a6b

@ -137,9 +137,6 @@ type summary_val = {
vsignature: string, vsignature: string,
vweight: int, vweight: int,
vproof_coverage: string, vproof_coverage: string,
vrank: string,
vin_calls: int,
vout_calls: int,
vproof_trace: string vproof_trace: string
}; };
@ -174,16 +171,6 @@ let summary_values summary => {
} else { } else {
float_of_int nr_nodes_visited /. float_of_int nodes_nr 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; let pp_failure failure => F.asprintf "%a" SymOp.pp_failure_kind failure;
{ {
vname: Procname.to_string proc_name, vname: Procname.to_string proc_name,
@ -205,9 +192,6 @@ let summary_values summary => {
vsignature: signature, vsignature: signature,
vweight: nodes_nr, vweight: nodes_nr,
vproof_coverage: Printf.sprintf "%2.2f" node_coverage, 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 vproof_trace: proof_trace
} }
}; };
@ -254,9 +238,6 @@ let module ProcsCsv = {
pp "\"%s\"," (Escape.escape_csv sv.vsignature); pp "\"%s\"," (Escape.escape_csv sv.vsignature);
pp "%d," sv.vweight; pp "%d," sv.vweight;
pp "%s," sv.vproof_coverage; 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 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_signature (Escape.escape_xml sv.vsignature),
subtree Io_infer.Xml.tag_weight (string_of_int sv.vweight), 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_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_proof_trace sv.vproof_trace,
subtree Io_infer.Xml.tag_flags (string_of_int (Hashtbl.length sv.vflags)) subtree Io_infer.Xml.tag_flags (string_of_int (Hashtbl.length sv.vflags))
]; ];

@ -164,7 +164,7 @@ let iterate_callbacks call_graph exe_env =
let should_reset = let should_reset =
is_none (Specs.get_summary proc_name) in is_none (Specs.get_summary proc_name) in
if should_reset 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. *) (* Make sure summaries exists. *)
List.iter ~f:reset_summary procs_to_analyze; List.iter ~f:reset_summary procs_to_analyze;

@ -1428,7 +1428,7 @@ let do_analysis exe_env =
if Config.dynamic_dispatch = `Lazy if Config.dynamic_dispatch = `Lazy
then Some pdesc then Some pdesc
else None in 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 List.iter
~f:(fun (pn, _) -> ~f:(fun (pn, _) ->

@ -133,15 +133,11 @@ let run_proc_analysis ~propagate_exceptions analyze_proc curr_pdesc callee_pdesc
attributes.loc.file) attributes.loc.file)
~default:SourceFile.empty ~default:SourceFile.empty
attributes_opt in 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 = let callee_pdesc_option =
if Config.dynamic_dispatch = `Lazy if Config.dynamic_dispatch = `Lazy
then Some callee_pdesc then Some callee_pdesc
else None in 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; Specs.set_status callee_pname Specs.Active;
source in source in

@ -298,7 +298,6 @@ type stats =
{ stats_time: float; (** Analysis time for the procedure *) { stats_time: float; (** Analysis time for the procedure *)
stats_failure: stats_failure:
SymOp.failure_kind option; (** what type of failure stopped the analysis (if any) *) 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 *) 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_fp : IntSet.t; (** Nodes visited during the footprint phase *)
mutable nodes_visited_re : IntSet.t; (** Nodes visited during the re-execution 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: @[<h>%a@]" Errlog.pp_warnings err_log F.fprintf fmt "WARNINGS: @[<h>%a@]" Errlog.pp_warnings err_log
let pp_stats whole_seconds fmt stats = 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_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 *) (** 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); pp_specs pe fmt (get_specs_from_payload summary);
F.fprintf fmt "</LISTING>@\n" F.fprintf fmt "</LISTING>@\n"
let empty_stats calls in_out_calls_opt = let empty_stats calls =
{ stats_time = 0.0; { stats_time = 0.0;
stats_failure = None; 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; symops = 0;
nodes_visited_fp = IntSet.empty; nodes_visited_fp = IntSet.empty;
nodes_visited_re = 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]. *) initializes the summary for [proc_name] given dependent procs in list [depend_list]. *)
let init_summary let init_summary
(nodes, (nodes,
proc_flags, calls, in_out_calls_opt, proc_flags, calls,
proc_attributes, proc_attributes,
proc_desc_option) = proc_desc_option) =
let summary = let summary =
@ -740,7 +734,7 @@ let init_summary
phase = FOOTPRINT; phase = FOOTPRINT;
sessions = ref 0; sessions = ref 0;
payload = empty_payload; payload = empty_payload;
stats = empty_stats calls in_out_calls_opt; stats = empty_stats calls;
status = Initialized; status = Initialized;
attributes = attributes =
{ proc_attributes with { proc_attributes with
@ -750,7 +744,7 @@ let init_summary
Procname.Hash.replace spec_tbl proc_attributes.ProcAttributes.proc_name 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. *) (** 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 let proc_attributes = match attributes_opt with
| Some attributes -> | Some attributes ->
attributes attributes
@ -760,7 +754,6 @@ let reset_summary call_graph proc_name attributes_opt proc_desc_option =
[], [],
ProcAttributes.proc_flags_empty (), ProcAttributes.proc_flags_empty (),
[], [],
Some (Cg.get_calls call_graph proc_name),
proc_attributes, proc_attributes,
proc_desc_option proc_desc_option
) )

@ -108,7 +108,6 @@ type stats =
{ stats_time: float; (** Analysis time for the procedure *) { stats_time: float; (** Analysis time for the procedure *)
stats_failure: stats_failure:
SymOp.failure_kind option; (** what type of failure stopped the analysis (if any) *) 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 *) 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_fp : IntSet.t; (** Nodes visited during the footprint phase *)
mutable nodes_visited_re : IntSet.t; (** Nodes visited during the re-execution 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 *) ( Procdesc.Node.id list * (* nodes *)
ProcAttributes.proc_flags * (* procedure flags *) ProcAttributes.proc_flags * (* procedure flags *)
(Procname.t * Location.t) list * (* calls *) (Procname.t * Location.t) list * (* calls *)
(Cg.in_out_calls option) * (* in and out calls *)
ProcAttributes.t * (* attributes of the procedure *) ProcAttributes.t * (* attributes of the procedure *)
Procdesc.t option) (* procdesc option *) Procdesc.t option) (* procdesc option *)
-> unit -> unit
(** Reset a summary rebuilding the dependents and preserving the proc attributes if present. *) (** 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 *) (** Load procedure summary from the given file *)
val load_summary : DB.filename -> summary option val load_summary : DB.filename -> summary option

Loading…
Cancel
Save