Summary: Add a flag `is-inclusive-cost` (`true` by default) which computes inclusive cost for each function. Setting the flag to `false` computes exclusive cost of the function where the cost of the callees are assumed to be `0`. Reviewed By: skcho Differential Revision: D20558275 fbshipit-source-id: 6b5798916master
parent
beaed4d820
commit
cf50a387e5
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
class ExclusiveTest {
|
||||||
|
|
||||||
|
void linear(int x) {
|
||||||
|
for (int i = 0; i < x; i++) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void call_linear_exclusive_constant(int x) {
|
||||||
|
linear(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void call_linear_exclusive_linear(int x) {
|
||||||
|
for (int i = 0; i < x; i++) {
|
||||||
|
linear(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the MIT license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
TESTS_DIR = ../../..
|
||||||
|
|
||||||
|
INFER_OPTIONS = --cost-only --no-inclusive-cost --bufferoverrun --debug-exceptions --use-cost-threshold
|
||||||
|
INFERPRINT_OPTIONS = --issues-tests
|
||||||
|
SOURCES = $(wildcard *.java)
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/javac.make
|
@ -0,0 +1,2 @@
|
|||||||
|
codetoanalyze/java/performance-exclusive/ExclusiveTest.java, ExclusiveTest.call_linear_exclusive_linear(int):void, 0, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 2 + 7 ⋅ x, O(x), degree = 1,{x},Loop at line 18]
|
||||||
|
codetoanalyze/java/performance-exclusive/ExclusiveTest.java, ExclusiveTest.linear(int):void, 0, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 2 + 5 ⋅ x, O(x), degree = 1,{x},Loop at line 10]
|
Loading…
Reference in new issue