A Portable and Customizable Profiling Framework for Java Based on Bytecode Instruction Counting

  • Walter Binder
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3780)


Prevailing profilers for Java, which rely on standard, native-code profiling interfaces, are not portable, give imprecise results due to serious measurement perturbation, and cause excessive overheads. In contrast, program transformations allow to generate reproducible profiles in a fully portable way with significantly less overhead. This paper presents a profiling framework that instruments Java programs at the bytecode level to build context-sensitive execution profiles at runtime. The profiling framework includes an exact profiler as well as a sampling profiler. User-defined profiling agents can be written in pure Java, too, in order to customize the runtime processing of profiling data.


Profiling program transformations bytecode instrumentation dynamic metrics Java JVM 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Ammons, G., Ball, T., Larus, J.R.: Exploiting hardware performance counters with flow and context sensitive profiling. In: PLDI 1997: Proceedings of the ACM SIGPLAN 1997 conference on Programming language design and implementation, pp. 85–96. ACM Press, New York (1997)CrossRefGoogle Scholar
  2. 2.
    Anderson, J., Berc, L., Dean, J., Ghemawat, S., Henzinger, M., Leung, S.-T., Sites, R., Vandervoorde, V., Waldspurger, C., Weihl, W.: Continuous profiling: Where have all the cycles gone? ACM Transactions on Computer Systems 15(4) (November 1997)Google Scholar
  3. 3.
    Arnold, M., Ryder, B.G.: A framework for reducing the cost of instrumented code. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 168–179 (2001)Google Scholar
  4. 4.
    Ball, T., Larus, J.R.: Optimally profiling and tracing programs. ACM Transactions on Programming Languages and Systems 16(4), 1319–1360 (1994)CrossRefGoogle Scholar
  5. 5.
    Ball, T., Larus, J.R.: Efficient path profiling. In: International Symposium on Microarchitecture, pp. 46–57 (1996)Google Scholar
  6. 6.
    Binder, W., Hulaas, J.: A portable CPU-management framework for Java. IEEE Internet Computing 8(5), 74–83 (2004)CrossRefGoogle Scholar
  7. 7.
    Binder, W., Hulaas, J.G., Villazón, A.: Portable resource control in Java. ACM SIGPLAN Notices 36(11), 139–155 (2001); Proceedings of the 2001 ACM SIGPLAN Conference on Object Oriented Programming, Systems, Languages and Applications (OOPSLA 2001)CrossRefGoogle Scholar
  8. 8.
    Choi, J.-D., Grove, D., Hind, M., Sarkar, V.: Efficient and precise modeling of exceptions for the analysis of Java programs. In: Proceedings of the ACM SIGPLAN–SIGSOFT Workshop on Program Analysis for Software Tools and Engineering, pp. 21–31. ACM Press, New York (1999)CrossRefGoogle Scholar
  9. 9.
    Dmitriev, M.: Profiling Java applications using code hotswapping and dynamic call graph revelation. In: WOSP 2004: Proceedings of the Fourth International Workshop on Software and Performance, pp. 139–150. ACM Press, New York (2004)CrossRefGoogle Scholar
  10. 10.
    Dufour, B., Driesen, K., Hendren, L., Verbrugge, C.: Dynamic metrics for Java. ACM SIGPLAN Notices 38(11), 149–168 (2003)CrossRefGoogle Scholar
  11. 11.
    Feller, P.: Value profiling for instructions and memory locations. Master Thesis CS1998-581, University of California, Sa Diego (April 1998)Google Scholar
  12. 12.
    Hulaas, J., Binder, W.: Program transformations for portable CPU accounting and control in Java. In: Proceedings of PEPM 2004 (2004 ACM SIGPLAN Symposium on Partial Evaluation & Program Manipulation), Verona, Italy, August 24–25, pp. 169–177 (2004)Google Scholar
  13. 13.
    Larus, J.R., Ball, T.: Rewriting executable files to measure program behavior. Software–Practice and Experience 24(2), 197–218 (1994)CrossRefGoogle Scholar
  14. 14.
    Liang, S., Viswanathan, D.: Comprehensive profiling support in the Java virtual machine. In: Proceedings of the 5th USENIX Conference on Object-Oriented Technologies and Systems (COOTS 1999), Berkeley, CA, May 3–7, pp. 229–240. USENIX Association (1999)Google Scholar
  15. 15.
    Sun Microsystems, Inc. Java Virtual Machine Profiler Interface (JVMPI). Web pages at
  16. 16.
    Sun Microsystems, Inc. JVM Tool Interface (JVMTI). Web pages at
  17. 17.
    The Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. Web pages at
  18. 18.
    Whaley, J.: A portable sampling-based profiler for Java Virtual Machines. In: Proceedings of the ACM 2000 Conference on Java Grande, June 2000, pp. 78–87. ACM Press, New York (2000)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Walter Binder
    • 1
  1. 1.Artificial Intelligence LaboratoryEcole Polytechnique Fédérale de Lausanne (EPFL)LausanneSwitzerland

Personalised recommendations