YACA-Monitor 1.0 - How to Enhance Static Call-Graph Analysis with Dynamic Data from Profiling?


Google+ Facebook Twitter LinkedIn Dzone Reddit Digg Blogger Hacker News Addthis

By Markus Sprunck; Revision: 1.3; Status: final; Last Content Change: Jul 13, 2013;

Static code analysis has been used for many years to find hints concerning errors, design weaknesses and/or compliance to guidelines. With static code analysis you may measure and improve the code quality.

Call-graphs out of pure static code analysis give not in all situations a clear picture of the inner structure of software. This is especially true for software which uses extensive late binding and/or inversion of control frameworks. The following sample application demonstrates this (see video).

Just try it and give me feedback. Maybe this approach is an interesting topic for a open source project. If you like to work on that topic, drop a mail (sprunck.markus@gmail.com).


Figure 1: Static and Dynamic Call-Graph Data 

Motivation

Modern enterprise software based on Java EE or Spring Framework is a good sample. In these cases static code analysis gives an overview about the single components (beans), but the dynamic call dependencies are missing. In this situation a developer has either to read a lot of source code or just starts the development environment, setting some breakpoints, debugs and analyses the call dependencies of the running software. 

Manual analysis of call dependencies is very time consuming and annoying. This was the motivation for me to combine static and dynamic analysis and write a graphic monitor to view the software in vivo. 

Demo

The following video gives a impression about the approach:


The Solution consists of two parts (i) a small agent which collects data and (ii) a web client for visualization.
  • Collection of data is done by the so called YacaAgent - a small java program - that collects the data for static call-graph analysis based on the ASM (Java byte code manipulation and analysis) framework. Data of the dynamic analysis are collected directly from the VM of the running Java software with the tools.jar library (of the JDK 1.6.0_23 or higher). The result can be fetched over HTTP (JSON with Padding - call back interface).

  • Visualization of data is done by the so called Yaca-Monitor (see http://yaca-monitor.appspot.com) - a small GWT application based on Googles AppEngine - that displays data from the YacaAgent in short intervals. Because the browser has to run a lot of JavaScript code, it is strongly recommended to use a modern browser like Google Chrome. The visualization of Yaca-Monitor is based on the d3.js (http://mbostock.github.com/d3) library.
This sample implementation is still in an experimental state, but it should demonstrates the benefit of the enhancement of static with dynamic call-graph analysis. 

Find Code on GitHub

Change History

 Revision  Date  Author  Description
 1.0  Mar 9, 2012  Markus Sprunck   first version
 1.1  Aug 20, 2012  Markus Sprunck  improved layout for tablets
 1.2  Jan 14, 2013  Markus Sprunck  improvements
 1.3  Jul 13, 2013  Markus Sprunck  added link to GitHub

Google+ Comments

You may press the +1 button to share and/or comment