I study More programming pearls (Addison-Wesley, 1988) by Bentley J., and I am stumped because I cannot find any Java tool / profiler that can tell me the number of times each statement is executed in the actual thread (link: optimization of the primary number search algorithm in Chapter 1). I tried using profilers, tried APIs, but maybe I'm looking at the wrong place. Can you guys pull out some magic trick / tool and point me in the right direction, or is it that we just can't do it in Java, since each statement may not generate exactly one machine instruction and save a counter for one the operator cannot possibly OR it is just a method of calculating the processor / call time with which we can watch and work on it.
source
share