| 1 | |
| 2 | == Code Visualization == |
| 3 | Execution Graph generated in one of our [wiki:Architecture four phases] can be a useful utility for day-to-day development or tuning and optimization, as it can give developers hints about parallel execution patterns or hot-spot code which is candidate for further manual optimization and code rewriting. As an option to our virtual machine prototype, we generate graphical representation for our execution graph. |
| 4 | |
| 5 | The following commands shows an example of using our visualization feature. The second line uses the generated representation from our engine to generate graph using [http://www.graphviz.org GraphViz] tool. |
| 6 | {{{ |
| 7 | ./<hydra vm directory>/rvm -X:hydra:dumb=true -X:hydra:class=Test Test > plotXX |
| 8 | dot -Tps plotXX -o graphXX.ps |
| 9 | }}} |
| 10 | We can narrow the visualization output to the scope of one class or certain package using '-X:hydra:class=...' and '-X:hydra:package=...' respectively. |
| 11 | |
| 12 | The generated graph composed of ''nodes'' that represents blocks and variables, and ''edges'' that shows the access frequency or the type of operation done on variables (read or write). |
| 13 | Nodes start with 'B' represent basic blocks, and it is followed by a number in which higher order digits are the method identifier and lower order ones for the block identifier. Nodes with 'V' prefix are the variables, the numbers indicate it is global variable if it is larger than 1000, and local variable otherwise. Edges connecting blocks are weighted with the number of times program flow moved between these two blocks, while edges connected to variables represent memory access from blocks to these variables; green edges for read and red ones for write.[[BR]] |
| 14 | |
| 15 | The graph can be simplified by filtering out memory access (variables access) in favor of focusing on control flow by using the following command. |
| 16 | {{{ |
| 17 | ./<hydra vm directory>/rvm -X:hydra:dumb=true -X:hydra:class=Test -X:hydra:novar=true Test > plotXX |
| 18 | }}} |
| 19 | |
| 20 | === Examples === |
| 21 | We tried our tool with [http://www-ali.cs.umass.edu/DaCapo/benchmarks.html JOlden benchmark] a Java version of [http://www.martincarlisle.com/olden.html Olden Benchmark] and the following links are the execution graphs generated. |
| 22 | * [/chrome/site/jolden/tsp.pdf TSP]: probabilistic analysis of partitioning algorithms for the traveling-salesman problem in the plane |
| 23 | * [/chrome/site/jolden/em3d.pdf EM3D]: electromagnetic waves through objects in 3 dimensions |
| 24 | * [/chrome/site/jolden/health.pdf Health]: Columbian health-care system |
| 25 | * [/chrome/site/jolden/mst.pdf MST]: computes the minimum spanning tree of a graph using Bentley's algorithm |
| 26 | * [/chrome/site/jolden/perimeter.pdf Perimeter]: pomputing perimeters of regions in images represented by Quadtrees |
| 27 | * [/chrome/site/jolden/power.pdf Power]: decentralized optimal power pricing |
| 28 | * [/chrome/site/jolden/treeadd.pdf TreeAdd]: performs a recursive depth first traversal of a binary tree and sums the value of each element in the tree |