Heapviz Interactive heap visualization for program understanding and

  • Slides: 32
Download presentation
Heapviz: Interactive heap visualization for program understanding and debugging Information Visualization, April 2013; vol.

Heapviz: Interactive heap visualization for program understanding and debugging Information Visualization, April 2013; vol. 12, 2: pp. 163 -177. , first published on May 7, 2012 Sean Kelley, Edward Aftandilian, Connor Gramazio, Nathan Ricci, Sara L. Su and Samuel Z. Guyer 2014/10/28 ryosuke 1

Author �Samuel Z. Guyer Associate Professor, Computer Science Department of Computer Science Tufts University

Author �Samuel Z. Guyer Associate Professor, Computer Science Department of Computer Science Tufts University �Edward Aftandilian software engineer at Google Ph. D. in the Department of Computer Science at Tufts University 2

Introduction �significant challenge today’s programs are larger and more complex than their predecessors modern

Introduction �significant challenge today’s programs are larger and more complex than their predecessors modern applications are constructed by assembling reusable software components Ex) web-based e-commerce, cloud computing platforms 3

Introduction �obtain a global understanding of the program’s state and behavior size and complexity

Introduction �obtain a global understanding of the program’s state and behavior size and complexity of software is a major impediment particularly based on static analysis of the code �Tools that analyze the dynamic behavior of programs focused on identifying performance problems rather than on general program understanding 4

Proposed Approach �Heapviz capable of effectively visualizing heap snapshots obtained from running Java programs

Proposed Approach �Heapviz capable of effectively visualizing heap snapshots obtained from running Java programs 5

Proposed Approach �The main challenge the scale of the data �Heapviz provides a global

Proposed Approach �The main challenge the scale of the data �Heapviz provides a global view of the data together with powerful interactive capabilities 6

solution �introduce algorithms for aggregating and abstracting individual objects �implement an interactive visualization inspect

solution �introduce algorithms for aggregating and abstracting individual objects �implement an interactive visualization inspect individual objects and field values search for objects based on type and field values group objects and hide/show/ color the groups explore the connectivity of the object graph 7

System overview �JVM + HPROF generates a heap snapshot �Heap analyzer parses the heap

System overview �JVM + HPROF generates a heap snapshot �Heap analyzer parses the heap snapshot �Heap visualizer reads the heap abstraction and displays the graph 8

Heap analysis �Heap snapshot obtained from a running Java program objects are currently in

Heap analysis �Heap snapshot obtained from a running Java program objects are currently in the heap, what their field values are snapshot provides the runtime type of each object instance Sun’s HPROF tool to generate heap snapshots dump. Heap() 9

Heap analysis �Heap analyzer parses it into a sequence of records ▪ class records,

Heap analysis �Heap analyzer parses it into a sequence of records ▪ class records, object instance records, root records Summarization algorithm 1. If there exists a reference from object o 1 to object o 2, and o 1 and o 2 are of the same type, merge o 1 and o 2 2. If objects o 1 and o 2 have the same set of predecessor objects (objects that point to o 1 or o 2) and are of the same type, merge o 1 and o 2 10

Heap visualization �The goal of the visualization an intuitive display of summarized heap data

Heap visualization �The goal of the visualization an intuitive display of summarized heap data an interactive environment where heap data can be easily explored �Graph display Force-directed layout ▪ Efficient use of screen space 11

Heap visualization �Visual encoding size, labels, and color �Interaction Graph display ▪ interactive node-edge

Heap visualization �Visual encoding size, labels, and color �Interaction Graph display ▪ interactive node-edge display ▪ pan, zoom, drag nodes, and bring up context menus 12

Heap visualization �Interaction Groups ▪ classify nodes ▪ hide, color, and combine Query and

Heap visualization �Interaction Groups ▪ classify nodes ▪ hide, color, and combine Query and selection ▪ Nodes carry a large amount of information on the examined program’s state 13

Case studies �Constructed examples show three constructed examples built using standard Java container classes

Case studies �Constructed examples show three constructed examples built using standard Java container classes �Real examples explore three real programs: _209_db, SPEC JBB 2000, and Heapviz itself 14

Constructed examples �Hash table poor hash function will cause too many elements to hash

Constructed examples �Hash table poor hash function will cause too many elements to hash into the same bin, resulting in O(n) debugging a program that uses a hash table use Heapviz to visualize the hash table and see whether elements are evenly distributed among bins 15

Constructed examples �Hash table two different Java Hash. Maps Containing 100 elements each 16

Constructed examples �Hash table two different Java Hash. Maps Containing 100 elements each 16

Constructed examples �Red–black tree a type of self-balancing binary search tree internal tree nodes

Constructed examples �Red–black tree a type of self-balancing binary search tree internal tree nodes are colored either red or black student wants to learn how to construct a tree in both the best and worst cases 17

Constructed examples �Red–black tree 1. loads the graph into Heapviz 18

Constructed examples �Red–black tree 1. loads the graph into Heapviz 18

Constructed examples �Red–black tree 2. hide the components and highlighted Integer objects 19

Constructed examples �Red–black tree 2. hide the components and highlighted Integer objects 19

Constructed examples �Red–black tree 3. selects all the Integers at once and hides them

Constructed examples �Red–black tree 3. selects all the Integers at once and hides them 20

Constructed examples �Red–black tree 4. hide the sentinel node 5. colors each internal node

Constructed examples �Red–black tree 4. hide the sentinel node 5. colors each internal node red or black according to a field value 21

Constructed examples �Overlapping elements Consider a program that contains multiple data structures of the

Constructed examples �Overlapping elements Consider a program that contains multiple data structures of the X objects in data structure X, some are pointed to only by X, some by X and y, and some by X and z. 22

Constructed examples �Overlapping elements has three data structures, a Tree. Map, a Hash. Set,

Constructed examples �Overlapping elements has three data structures, a Tree. Map, a Hash. Set, and a Linked. List, using the standard implementations in the Java class library contain Int. Box objects , some of which are shared by two or all three data structures 23

Constructed examples �Overlapping elements 24

Constructed examples �Overlapping elements 24

Real examples �_209_db database benchmark from the SPEC JVM 98 benchmark suite performs multiple

Real examples �_209_db database benchmark from the SPEC JVM 98 benchmark suite performs multiple database operations on an inmemory database 25

Real examples �_209_db 26

Real examples �_209_db 26

Real examples �SPEC JBB 2000 The SPEC JBB 2000 benchmark emulates a three- tier

Real examples �SPEC JBB 2000 The SPEC JBB 2000 benchmark emulates a three- tier client–server system The system models a wholesale company, with warehouses serving different districts and customers placing orders 27

Real examples �SPEC JBB 2000 the graph is still too visually complex some clues

Real examples �SPEC JBB 2000 the graph is still too visually complex some clues as to limitations of the summarization algorithm 28

Real examples �Heapviz on Heapviz prototypes of the Heapviz heap analyzer component required too

Real examples �Heapviz on Heapviz prototypes of the Heapviz heap analyzer component required too much memory to summarize large graphs decided to apply Heapviz to itself 29

Real examples �Heapviz on Heapviz To debug our excessive memory usage problem, we first

Real examples �Heapviz on Heapviz To debug our excessive memory usage problem, we first looked at nodes that represent a large amount of memory public class Value{ public Type type; private long obj. Val; private boolean bool. Val; private char. Val; private float. Val; private double. Val; private byte. Val; private short. Val; private int. Val; private long. Val; } 2. 1 MB 30

Real examples �Heapviz on Heapviz refactored the Value class into an abstract parent- class

Real examples �Heapviz on Heapviz refactored the Value class into an abstract parent- class Value and concrete subclasses for each type of value each containing only the necessary fields for that type 31

Conclusion �presented a tool for helping programmers analyze, visualize, and navigate heap snapshots from

Conclusion �presented a tool for helping programmers analyze, visualize, and navigate heap snapshots from running Java programs �Heapviz enables users to navigate large, pointer-based data structures at a wholeprogram scale 32