From aea1b4095e055ddc44350364175d7e03f5f3bf9c Mon Sep 17 00:00:00 2001 From: Martino Luca Date: Fri, 14 Sep 2018 03:08:47 -0700 Subject: [PATCH] [Perf][CI] Disable threshold based cost reports Reviewed By: ezgicicek Differential Revision: D9810693 fbshipit-source-id: fc07461cd --- infer/src/base/Config.ml | 7 +++++++ infer/src/base/Config.mli | 2 ++ infer/src/checkers/cost.ml | 4 +++- infer/tests/codetoanalyze/c/performance/Makefile | 2 +- infer/tests/codetoanalyze/java/performance/Makefile | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 24981413a..eaab8e677 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -2195,6 +2195,11 @@ and unsafe_malloc = "Assume that malloc(3) never returns null." +and use_cost_threshold = + CLOpt.mk_bool ~long:"use-cost-threshold" ~default:false + "Emit costs issues by comparing costs with a set threshold" + + and version = let var = ref `None in CLOpt.mk_set var `Full ~deprecated:["version"] ~long:"version" @@ -2980,6 +2985,8 @@ and uninit_interproc = !uninit_interproc and unsafe_malloc = !unsafe_malloc +and use_cost_threshold = !use_cost_threshold + and worklist_mode = !worklist_mode and write_dotty = !write_dotty diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index e721d829c..e3c9cea45 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -200,6 +200,8 @@ val undo_join : bool val unsafe_unret : string +val use_cost_threshold : bool + val weak : string val whitelisted_cpp_methods : string list diff --git a/infer/src/checkers/cost.ml b/infer/src/checkers/cost.ml index 5a12be395..9e89609f8 100644 --- a/infer/src/checkers/cost.ml +++ b/infer/src/checkers/cost.ml @@ -629,7 +629,9 @@ module TransferFunctionsWCET = struct (* We don't report when the cost is Top as it corresponds to subsequent 'don't know's. Instead, we report Top cost only at the top level per function when `report_infinity` is set to true *) let should_report_cost cost = - (not (BasicCost.is_top cost)) && not (BasicCost.( <= ) ~lhs:cost ~rhs:expensive_threshold) + Config.use_cost_threshold + && (not (BasicCost.is_top cost)) + && not (BasicCost.( <= ) ~lhs:cost ~rhs:expensive_threshold) let do_report summary loc cost = diff --git a/infer/tests/codetoanalyze/c/performance/Makefile b/infer/tests/codetoanalyze/c/performance/Makefile index e8aabbab0..4b8b4673e 100644 --- a/infer/tests/codetoanalyze/c/performance/Makefile +++ b/infer/tests/codetoanalyze/c/performance/Makefile @@ -8,7 +8,7 @@ TESTS_DIR = ../../.. ANALYZER = checkers # see explanations in cpp/errors/Makefile for the custom isystem CLANG_OPTIONS = -c -INFER_OPTIONS = --cost-only --debug-exceptions --project-root $(TESTS_DIR) +INFER_OPTIONS = --cost-only --debug-exceptions --project-root $(TESTS_DIR) --use-cost-threshold INFERPRINT_OPTIONS = --issues-tests SOURCES = $(wildcard *.c) diff --git a/infer/tests/codetoanalyze/java/performance/Makefile b/infer/tests/codetoanalyze/java/performance/Makefile index 63496791a..91cdc2d33 100644 --- a/infer/tests/codetoanalyze/java/performance/Makefile +++ b/infer/tests/codetoanalyze/java/performance/Makefile @@ -6,7 +6,7 @@ TESTS_DIR = ../../.. ANALYZER = checkers -INFER_OPTIONS = --cost-only --debug-exceptions +INFER_OPTIONS = --cost-only --debug-exceptions --use-cost-threshold INFERPRINT_OPTIONS = --issues-tests SOURCES = $(wildcard *.java)