Object Oriented program execution Visualization of Dynamic Program Kees Huizing Ruurd Kuiper Pieter Deelen Huub van de Wetering Frank van Ham Technische Universiteit Eindhoven Netherlands IPA Herfst 2008
Virtual Machines Rule used in increasing number of places Possibility to monitor during execution E.g., JDI (Java Debugger Interface) Combine with visualization
JDI Monitor running virtual machine (from another VM) Event based complete API
Ideas Use visualization when you don t know yet what you re looking for before debugging (experienced programmers) before concept building (novice programmers)
Part 1 TraceVis strengthen understanding of relation static code and dynamic execution allow for medium sized program, hundreds of classes
Part II CoffeeDregs provide insight (literally) in executing machine help building operational mind model small programs, few classes
Part I TraceVis What is software? UML Java XML artefacts the design or the product
Both Design is about documents Product is about execution Developer needs to relate execution information back to design (classes) classes are out of sight during execution
Idea execution activity is method call design unit is class collect call information during execution relate back to classes (or objects) visualization: bring classes back into sight during execution
Data collection trace of actual execution of Java program using JVMTI and Byte Code Instrumentation :;%67$#9< ="4<"(> '79&*49 /4)#?#%& +,*@31.#&7(5#A($#49 0445.#"$7(5 /(68#9% -./01 2($( 3455%6$4"!"#$%& 0"(6% '%()*+, events: method entry/exit, object (de)allocation, etc. example of two events method entry thread MN:1140465267615763000:1:org10x10/dambo/app/rambo/Biter:f2i:0 MX:1140465267615857000:1:org10x10/dambo/app/rambo/Biter:f2i timestamp class object method
Dynamic call graph nodes are classes edges are collections of method calls Visualize as node-link diagram with dynamic springembedder layout!"#$$%&'%(&) &*%$(#+,!"#$$%'&( -'%$(#+,!"#$$%&'%.&((&/% &*%$(#+, number of calls
Suppose call of method m( ) on object o To which node (class) we draw the edge? declaring class: static view defining class: executing code view class of receiving object: interacting objects view P + m() {abstract} + m() Q Declaring class Defining class R Object class (class of o)
Visualization graph gives good overview of the dynamic structure, not of the history/future add Timeline View random access to trace compact visualization of Sequence Diagram on class level extra class information (nr of instances, time spent)
!"#$%"#$&'( '(#' )*%%+,"-, ('&*"%,."'/ )*%%+,"-, *0&"."&1,."'/
$"-'./%-%& $"-'./%-%& $#%&' $#%&'!""#!""# $#%&' (")*"+&,'&- (")*"+&,'&- $#%&'
Zoomed in Timeline View
Call from A to B to C 8/211#1$9*)4#)#4$(:$32%*%-32/$%2'#; <35-=25-* % 7.#3&5-*%$!-'#!"#$%&'(#)$*+$,-.#/$)*01$+*)$2$ 3/211$4#,#%41$ *%$5"#$2'*&%5$ *+$5-'#$1,#%5$-%$ 5"-1$3/2116!"#$125&)25-*%$*+$ 2$,-.#/$4#,#%41$ *%$5"#$2'*&%5$ *+$235-=-5:6
Evaluation draughts playing program Rambo insight in AI module object creation expensive methods software build tool Ant insight in software structure relation to external programs
Conclusions & Future effcient trace collection provides insight in dynamic interaction of classes space efficient rendering of sequence diagrams scalability: exploit package hierarchy with hier. edge bundles; avoid overlapping nodes theme river for timeline real-time data visualization
Part II CoffeeDregs Novice programmers problems with understanding the basic blocks algemener probleem waaruit onderstaande misconceptie voorkomt? typical misconception: while means while (instead of while is guard is true when execution arrives here ) problems with difference objects vs. classes coherent (operational) model is often missing
Help building operational model show what s happens inside computer on the right level of abstraction no prefab: student s own program will be visualized too Note: later other views than operational will be needed, but operational model is the basis
Note students/pupils have less technical experience than they used to (even comp. sc. students) mental image of computer often inadequate
Java execution concepts objects methods program (thread) location stack data
Abstraction level variables pointers unit of step: line of own code third party objects and code are not shown methods are shown when active
Visualization objects as boxes pointers as values and as arrows active methods are vis d in receiver objects call stack by arrows stack (local variables) is distributed over objects expression execution is not visualized