[Infer][Perf] Make reports more human readable

Reviewed By: ezgicicek

Differential Revision: D12956943

fbshipit-source-id: d94dcaed4
master
Martino Luca 6 years ago committed by Facebook Github Bot
parent ef2cfa7b40
commit 8d410d63c0

@ -144,9 +144,15 @@ let issue_of_cost cost_info ~delta ~prev_cost ~curr_cost =
| `Increased ->
Format.fprintf fmt "increased"
in
Format.asprintf "Max degree %a from %a to %a. Cost is %a (degree is %a)" pp_delta delta
CostDomain.BasicCost.pp_degree prev_cost CostDomain.BasicCost.pp_degree curr_cost
CostDomain.BasicCost.pp curr_cost CostDomain.BasicCost.pp_degree curr_cost
let pp_raw_cost fmt cost_polynomial =
if Config.developer_mode then
Format.fprintf fmt " Cost is %a (degree is %a)" CostDomain.BasicCost.pp cost_polynomial
CostDomain.BasicCost.pp_degree cost_polynomial
else ()
in
Format.asprintf "Complexity %a from %a to %a.%a" pp_delta delta
CostDomain.BasicCost.pp_degree_hum prev_cost CostDomain.BasicCost.pp_degree_hum curr_cost
pp_raw_cost curr_cost
in
let line = cost_info.Jsonbug_t.loc.lnum in
let column = cost_info.Jsonbug_t.loc.cnum in

@ -412,6 +412,26 @@ module NonNegativePolynomial = struct
Format.pp_print_int fmt (NonNegativeNonTopPolynomial.degree p)
let pp_degree_hum fmt p =
match p with
| Top ->
Format.pp_print_string fmt "Top"
| NonTop p -> (
match NonNegativeNonTopPolynomial.degree p with
| 0 ->
Format.pp_print_string fmt "constant"
| 1 ->
Format.pp_print_string fmt "linear"
| 2 ->
Format.pp_print_string fmt "quadratic"
| 3 ->
Format.pp_print_string fmt "cubic"
| 4 ->
Format.pp_print_string fmt "quartic"
| d ->
Format.fprintf fmt "O(N^%d)" d )
let encode astate = Marshal.to_string astate [] |> B64.encode
let decode enc_str = Marshal.from_string (B64.decode enc_str) 0

@ -58,6 +58,8 @@ module NonNegativePolynomial : sig
val pp_degree : Format.formatter -> astate -> unit
val pp_degree_hum : Format.formatter -> astate -> unit
val encode : astate -> string
val decode : string -> astate

Loading…
Cancel
Save