Is there a way to determine the general cost function of an arbitrary java method?

I am interested to know if there is already such an approach that takes the java method code as input and determines the cost function of such code (number of cycles, ifs / elses, I / O and other common things). I do not mean the exact cost in ms, but some common costs that this code can cause. The fact is that I want to be able for an arbitrary method that the user writes to say what the cost of such a method might be (of course, without taking into account some features, such as the JVM, etc.).

+5
source share
2 answers

I don’t know if such a tool exists, but I doubt its capabilities and its usability:

, , , , .

+5

, /elses, . . , JavaNCSS. , , . , . , . , PMD - - .

, . thkala, - JVM JIT- . - , () . , . IDE . , , .

+1

All Articles