2. A complete description of our optimization schemes targeted at re- ducing the overheads. One of them, a static path prediction scheme, is novel as compared to our earlier work.
This article is structured as follows: In Section 2 we present the design goals pursued. Section 3 introduces the basic ideas and principles of CPU accounting through bytecode instrumentation. Section 4 anal- yses the origin of various overheads that are due to the extra bytecode instructions introduced by the instrumentation, and the following two sections propose and evaluate several optimization schemes for reducing these overheads. Section 7 evaluates the overall performance of applica- tions using our new CPU accounting scheme and discusses the benefits and limitations of our approach. This article ends with related work and a conclusion.
2. Design Goals
Traditionally, the CPU consumption of a program is measured in seconds. This approach, however, has several drawbacks: It is platform- dependent (for the same program and input, the CPU time differs depending on hardware, operating system, and virtual machine), mea- suring it accurately may require platform-specific features (such as special operating system functions) limiting the portability of the CPU management services, and the resulting CPU consumption may not be easily reproducible, as it may depend on external factors such as the system load.
For these reasons, we use the number of executed JVM bytecode instructions as our CPU consumption metric. While this metric is not directly translatable into real CPU time, it has many advantages:
− Platform-independence: The number of executed bytecode in- structions is a platform-independent, dynamic metric . It is independent of the hardware and virtual machine implementation (e.g., interpretation versus just-in-time compilation). However, the availability of different versions and implementations of the Java class library (the classes of the Java development kit) may limit the platform-independence of this metric.
− Reproducibility: For deterministic programs, the CPU con- sumption measured in terms of executed bytecode instructions is exactly reproducible, if the same Java class library is used. However, reproducibility cannot be guaranteed for programs with non-deterministic thread scheduling.