English 中文(简体)
Are there any tools to visualize the objects being used in a program?
原标题:

I m not sure how useful this would be, but I thought it might be neat to visualize the objects being used in my program and which objects are being referenced from where. I m guessing it would generate some data that would be used by a program like graphviz. Are there any tools that do this, otherwise how hard would it be to do this myself? Ideally this would work for any arbitrary program, though if necessary I could make some modifications to the code (such as to add a dumpObjects() call or whatever)

I m interested in doing this for java, but if there are solutions for other languages please post those too.

最佳回答

A profiler would allow you to see what objects are created at runtime. This is the output of JProfiler for instance:

jprofiler heap walker
(source: ej-technologies.com)

问题回答

Sun have developed the VisualVM which includes memory and process profiling. It also supports plugins for technology such as OSGi.

An interesting use case would be memory analysis and optimization. This is precisely what Eclipse MAT is about. Check it out.

alt text http://dev.eclipse.org/blogs/memoryanalyzer/files/2008/05/dom_tree.gif

For visualising graph structures (including object graphs), there are lots of tools based on GraphViz: http://www.graphviz.org/

There is the Object Graph Visualizer which displays classes and objects in 3D. For now it lacks an API to automate the initialization, however it shouldn t be too difficult to add this functionality. Source code also on Github.

Edit: There is already work being done in that direction apparently: https://eprints.hsr.ch/491/

OGV

not sure if that is what you are aiming at, but doxygen will do pretty much all of that.

it will take a heap of compiling code and turn it into cross referenced html, rtf of pdf. completed will calling tree for each function and "referenced by " for each variable





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签