Java Reference
In-Depth Information
1. Sampling-based profilers are the most common kind of profiler.
2. Because of their relatively low profile, sampling profilers introduce fewer meas-
urement artifacts.
3. Different sampling profiles behave differently; each may be better for a particular
Instrumented Profilers
Instrumented profilers are much more intrusive than sampling profilers, but they can also
give more beneficial information about what's happening inside a program. Figure 3-3 uses
the same profiling tool to look at startup of the same GlassFish domain, but this time it is us-
ing instrumented mode.
Figure 3-3. An instrumented profile
A few things are immediately apparent about this profile. First, notice that the “hot” method
is now getPackageSourcesInternal() , accounting for 13% of the total time (not 4%, as in
the previous example). There are other expensive methods near the top of the profile, and the
defineClass1() method doesn't appear at all. The tool also now reports the number of
times each method was invoked, and it calculates the average time per invocation based on
that number.
Is this a better profile than the sampled version? It depends; there is no way to know in a giv-
en situation which is the more accurate profile. The invocation count of an instrumented pro-
file is certainly accurate, and that additional information is often quite helpful in determining
Search WWH ::

Custom Search