Steven Gong wrote: > Is the sampling process done before running or during runtime?
Sampling, like counter incrementing, is done at runtime. They are both runtime profiling techniques to try to ascertain what methods are important. The profile (whether method counts or samples) is used during the same run to drive a strategy of how to use the JIT. > If it's done during runtime, does it mean that some methods may be compiled several time > by different leveled JIT? Yes, even systems that use an interpreter as the initial execution strategy will have several levels of JITs to use for different types of methods. For example, as the program executes, a medium important method may look more important as time goes on, and thus, a higher level of JIT optimization can be chosen. There are two papers that cover the topic of recompilation (using a JIT, rather that the details of the JIT) in detail OOPSLA'00 (Jikes RVM): "Adaptive optimization in the Jalapeno JVM." http://www.research.ibm.com/people/h/hind/papers.html#oopsla00 OOPSLA'01 (IBM DK): "A dynamic optimization framework for a Java just-in-time compiler." http://portal.acm.org/citation.cfm?id=504311.504296 Mike