Dynamic analysis of program behavior helps understand many software properties that are difficult to ascertain from code alone, such as coverage, resource requirements or execution performance. Dynamic program analysis requires flexible monitoring of program execution and efficient processing of collected observations.

Bytecode Instrumentation injects bytecode snippets into selected program locations. Injected snippets can collect information and trigger or execute dynamic program analysis. Correct dynamic program analysis requires fine control over bytecode injection, minimizing overhead and disruption are also a must.

Program Instrumentation

Dynamic program analysis tools need to observe program execution. One approach to execution observation is based on instrumenting the observed program, inserting probes into program locations of interest - when the program execution reaches such location, the probe code is also executed. Executing in the context of the observed program, the probe is well positioned to collect information required by the dynamic analysis.

We contribute to the development of DiSL [3], a tool for bytecode instrumentation that works with standard JVM implementations. The tool is geared towards flexibility and efficiency, and although there are some practical limits to what can be achieved through bytecode instrumentation [1], it still surpasses other bytecode instrumentation tools in coverage, flexibility and productivity [2].


The code below presents a simple probe to profile method execution time, expressed in DiSL. This and other examples are available in [3], and included with the tool download:

public class SimpleProfiler {

	static long entryTime;

	static void onMethodEntry() {
		entryTime = System.nanoTime();

	static void onMethodExit() {
		System.out.println("Method duration " + (System.nanoTime() - entryTime));

Remote Dynamic Analysis

Dynamic analysis executing in the context of the observed program is prone to interference between the program and the analysis. To reduce such interference, DiSL also provides the option of executing the analysis remotely, delivering the events of interest using a remote API [5].

Remote dynamic analysis is also beneficial in environments that either do not have the computational power to run the analysis together with the observed program, or run distributed. We demonstrate this by supporting program instrumentation on Android, connecting the observed program on a Dalvik JVM with remote analysis on a HotSpot JVM [6].

Analysis Composition

Program instrumentation is often expensive, in terms of both the development effort and the execution overhead. The problem is further exacerbated when multiple analyses are to run concurrently [8]. We therefore investigate the option of composing multiple analyses in a modular fashion, reducing redundancy and thus making instrumentation cheaper [7].


The research activities related to dynamic program analysis are part of an international research effort coordinated by University of Lugano. Locally, this work has been supported by the EU project 257414 ASCENS, the SCIEX NMS exchange projects 10.165 and 11.109, the GACR projects P202/10/J042 FERDINAND and 201/09/H057 RES INFORMATICA, and by the Charles University institutional funding SVV-2012-265312 and SVV-2013-267312.


Lubomír Bulej lubomir.bulej<at-sign>d3s.mff.cuni.cz


  • [1]Kell S., Ansaloni D., Binder W., Marek L., The JVM is not observable enough (and what to do about it), In proceedings of the 6th workshop on Virtual Machines and Intermediate Languages (VMIL), Tucson, AZ, USA, ACM, ISBN: 978-1-4503-1633-0, pp. 33-38, November 2012. PDF, Link
  • [2]Sarimbekov A., Zheng Y., Ansaloni D., Bulej L., Marek L., Binder W., Tůma P., Qi Z., Dynamic Program Analysis - Reconciling Developer Productivity and Tool Performance, In Science of Computer Programming, Volume 95, Part 3, Elsevier, ISSN 0167-6423, pp. 344-358, December 2014. PDF, Link
  • [3]Marek L., Zheng Y., Ansaloni D., Bulej L., Sarimbekov A., Binder W., Tůma P., Introduction to Dynamic Program Analysis with DiSL, In Science of Computer Programming, 5th Special Issue on Experimental Software and Toolkits, Volume 98, Part 1, Elsevier, ISSN 0167-6423, pp. 100-115, February 2015. PDF, Link
  • [4]Zheng Y., Ansaloni D., Marek L., Sewe A., Binder W., Villazón A., Tůma P., Qi Z., Mezini M., Turbo DiSL: Partial Evaluation for High-Level Bytecode Instrumentation, In Proceedings of the 50th International Conference on Objects, Models, Components, Patterns (TOOLS 2012), Prague, Czech Republic, Springer, ISBN: 978-3-642-30560-3, pp. 353-368, May 2012. PDF, Link
  • [5]Marek L., Kell S., Zheng Y., Bulej L., Tůma P., Binder W., Ansaloni D., Sarimbekov A., Sewe A., ShadowVM: Robust and Comprehensive Dynamic Program Analysis for the Java Platform, In proceedings of the 12th International Conference on Generative Programming: Concepts & Experiences (GPCE), Indianapolis, IN, USA, ACM, ISBN: 978-1-4503-2373-4, pp. 105-114; also in ACM SIGPLAN Notices, 49(3):105–114, ISSN: 0362-1340, October 2013. PDF, Link
  • [6]Sun H., Zheng Y., Bulej L., Villazón A., Qi Z., Tůma P., Binder W., A Programming Model and Framework for Comprehensive Dynamic Analysis on Android, In proceedings of the 14th International Conference on Modularity (MODULARITY/AOSD), Fort Collins, Colorado, USA, ACM, ISBN: 978-1-4503-3249-1, pp. 133-145, March 2015. PDF, Link
  • [7]Ansaloni D., Kell S., Zheng Y., Bulej L., Binder W., Tůma P., Enabling Modularity and Re-use in Dynamic Program Analysis Tools for the Java Virtual Machine, In proceedings of the 27th European Conference on Object-Oriented Programming (ECOOP), Montpellier, France, Springer, LNCS 7920, ISBN: 978-3-642-39037-1, ISSN: 0302-9743, pp. 352-377, July 2013. PDF, Link
  • [8]Ansaloni D., Binder W., Bockisch Ch., Bodden E., Hatun K., Marek L., Qi Z., Sarimbekov A., Sewe A., Tůma P., Zheng Y., Challenges for Refinement and Composition of Instrumentations: Position Paper, In Proceedings of Software Composition - 11th International Conference, SC 2012, Prague, Czech Republic, Springer, ISBN: 978-3-642-30563-4, pp. 86-96, May 2012. PDF, Link
Logo of Faculty of Mathematics and Physics
  • Phone: +420 951 554 267, +420 951 554 236
  • Email: info<at-sign>d3s.mff.cuni.cz
  • How to find us?
Modified on 2016-02-11