Information Technology Reference
In-Depth Information
default behavior is to update the active count at the
beginning of each basic block, which is defined
as a sequence of bytecode that end with a control
flow instruction. At each decrement, a consump-
tion check is made to determine whether the
custom agent (processSample) should be called.
The following excerpt illustrates in pseudo-code
the Komorium binary rewriting: (Box 7)
Binder , Hulaas, and Villaz (2001) evaluated
the Komorium approach through experimentation.
They showed that their approach could sample
at an accuracy of 91% using an overlapping per-
centage metric (Arnold & Ryder, 2001). The best
results were obtained from a profiling granularity
of 5,000-10,000 bytecodes per sample, resulting
in an average overhead of 47-56% for a 10,000
bytecode granularity.
VM sampling-based profiling provides an ef-
fective method of collecting temporal information
relating to program control. These techniques are
can be used to determine task latency, jitter, and
execution quanta, as well as to identify patterns
of processor migration.
Profiling via VM Hooks
A VM hook represents an access point to a previ-
ously defined event, such as method entry/exit or
thread start/stop, that can occur within the context
of a running application. The profiling agent
implements callback methods on the profiling
interface and registers them with the appropriate
VM hooks. The VM then detects the events and
invokes the corresponding callback method when
these events occur in the application. It is straight-
forward to develop profilers based on VM hooks
because profiler developers need only implement
an interface provided by the VM, without worry-
ing about the complications that can arise from
modifying the application directly.
Box 7.
// Pseudo Java code illustrating Komorium re-writing. bold represents additional
// code added by Komorium.
//
// ac = per-thread activation counter representing the upper bound of the
// number of executed bytecodes
//
// mids, sp = represents reifed method ids, stack pointer pair
//
class Foo {
private static final MID mid_sum;
static {
String cl = Class.forName(“Foo”).getName();
mid_sum = createMID(c1, “sum”, “(II)I”);
}
static int sum(int from, int to, ac ac, mid[] mids, int sp ) {
mids[sp++] = mid_sum;
decrementAC(2);
if(getValue(ac) <= 0)
setValue(ac, processSample(mids, sp));
int result = 0;
while(true) {
continued on following page
 
Search WWH ::




Custom Search