More‎ > ‎

YACA-Monitor 2.0 - Live Visualization of Call Stack in Running Java Applications with THREE.js

BY MARKUS SPRUNCK


This experiment demonstrates how to visualize the method calls of a running Java application with a web client. The application uses THREE.js to render the graphic with webGL. (see http://yaca-monitor-webgl.appspot.com)

A
 small agent process connects to a running Java Virtual Machine and collects call stack information of the running process. The result is a live picture of the dynamic call graph. (see http://yaca-monitor-webgl.appspot.com/bin/YacaAgent.zip)

The rendering of the call graph uses a n-body-simulation which calculates the forces 
(charge, gravity and springs) and movements between the single nodes. For this Barnes-Hut-Algorithm has been implemented in JavaScript.

YouTube Video

Motivation

Most software developers spend a large portion of their available coding time with the attempt to understand existing legacy source code, frameworks, medium level design and the typical call dependencies in a software. Debugging application to find out the call graph and control flow is extremely time consuming. You set a break-point and analyse the call stack to find the way across all the layers and components of the program.

This experiment is based on my previous work and article How to Enhance Static Call-Graph Analysis with Dynamic Data from Profiling? The big difference is that I removed all the static analysis data and introduced a high performance 3D rendering based on webGL. To understand what happens in a piece of software it is just needed to have a look at what really happens. Analyse real world software results in hundreds or even thousands of active method call within some seconds. The important point is to render just the relevant information.

Implementation 

The Solution consists of two parts: 
  • YacaAgent - is a small standalone java agent program - collects dynamic call stack data directly from the VM of a running Java software with the tools.jar library (of the JDK 1.6.0_23 or higher). The result can be fetched over HTTP. To enable access from the client the agent provides a callback interface (JSON with Padding).

  • YacaMonitor - is a small web application - that displays call graph data in 3D. It fetches data from the agent every 2 seconds. The 3D webGL visualization of Yaca-Monitor is based on the based on THREE.js library (https://github.com/mrdoob/three.js). 
Remarks
  • Because the browser has to run a lot of JavaScript code and webGL, it is strongly recommended to use a modern browser like Google Chrome.

  • You need a Java SDK to run the YacaAgent because the code is based on tools.jar library. Just change in the file YacaAgent-Start.bat with your SDK installation path.

Find Code on GitHub

Sponsored Link