|
Instrumentation-based profiling has many advantages and one serious
disadvantage: usually high performance overhead. This overhead can be
substantially reduced if only a small part of the target application (for
example, one that has previously been identified as a performance
bottleneck) is instrumented, while the rest of the application code runs at
full speed. Such an approach can also beat scalability issues caused by a
high volume of profiling information generated by instrumented code running
on behalf of multiple threads. The value of such a profiling technology
would increase further if the code could be instrumented and
de-instrumented as many times as needed at run time.
In this report we describe in detail the design of an experimental
profiling system called JFluid, which includes a modified Java
HotSpot™ VM and a GUI tool, and addresses both of the above issues.
Our JVM™ supports arbitrary on-the-fly modifications to running Java
methods, and can connect with a profiling tool at any moment, without any
startup time preparation. Our tool collects, processes and presents
profiling data on-line. To perform CPU profiling, it instruments a group of
methods defined as an arbitrary "root" method plus all methods that it
calls (a call subgraph). It appears that static determination of all
methods in a call subgraph is difficult in the presence of virtual methods,
but fortunately, with dynamic code hotswapping available, two schemes of
dynamic call subgraph revelation and instrumentation can be suggested.
Measurements that we obtained when performing full and partial program
profiling using both schemes show that the overhead can be reduced
substantially using this technique, and that one of the schemes generally
results in a smaller number of instrumented methods and better performance,
especially for large applications.
|