1- java-callgraph: Java Call Graph Utils
2- =====================================
1+ java-callgraph: Java Call Graph Utilities
2+ =========================================
33
44A suite of programs for generating static and dynamic call graphs in Java.
55
@@ -27,19 +27,23 @@ graph generator
2727
2828#### Run
2929
30+ Instructions for running the callgraph generators
31+
3032##### Static
3133
34+ ` javacg-static ` accepts as arguments the jars to analyze.
35+
3236<code >
3337java -jar javacg-0.1-SNAPSHOT-static.jar lib1.jar lib2.jar...
3438</code >
3539
3640##### Dynamic
3741
38- ` javacg-dynamic ` uses the
42+ ` javacg-dynamic ` uses
3943[ javassist] ( http://www.csg.is.titech.ac.jp/~chiba/javassist/ ) to insert probes
4044at method entry and exit points. To be able to analyze a class ` javassist ` must
4145resolve all dependent classes at instrumentation time. To do so, it reads
42- classes from the JVM's boot classloader. However the JVM sets the boot
46+ classes from the JVM's boot classloader. By default, the JVM sets the boot
4347classpath to use Java's default classpath implementation (` rt.jar ` on
4448Win/Linux, ` classes.jar ` on the Mac). The boot classpath can be extended using
4549the ` -Xbootclasspath ` option, which works the same as the traditional
@@ -51,17 +55,21 @@ Moreover, since instrumenting all methods will produce huge callgraphs which
5155are not necessarily helpful (e.g. it will include Java's default classpath
5256entries), ` javacg-dynamic ` includes support for restricting the set of classes
5357to be implemented through include and exclude statements. The options are
54- appended to the ` -javaagent ` switch and has the following format
58+ appended to the ` -javaagent ` argument and has the following format
5559
5660<code >-javaagent: javacg-dycg-agent .jar="incl=mylib.* ,mylib2.* ,java.nio.* ;excl=java.nio.charset.* "</code >
5761
5862The example above will instrument all classes under the the ` mylib ` , ` mylib2 ` and
5963` java.nio ` namespaces, except those that fall under the ` java.nio.charset ` namespace.
6064
6165<code >
62- java -Xbootclasspath::/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar: mylib .jar -javaagent: javacg-0 .1-SNAPSHOT-dycg-agent.jar="incl=mylib.* ;" -classpath mylib.jar mylib.Mainclass
66+ java
67+ -Xbootclasspath:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar: mylib .jar
68+ -javaagent: javacg-0 .1-SNAPSHOT-dycg-agent.jar="incl=mylib.* ;"
69+ -classpath mylib.jar mylib.Mainclass
6370</code >
6471
72+
6573#### Examples
6674
6775The following examples instrument the
@@ -75,7 +83,8 @@ Running the batik Dacapo benchmark:
7583
7684<code >
7785java -Xbootclasspath:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar: jar /batik-all.jar: jar /xml-apis-ext.jar -javaagent: target /javacg-0.1-SNAPSHOT-dycg-agent.jar="incl=org.apache.batik.* ,org.w3c.* ;" -jar dacapo-9.12-bach.jar batik -s small |tail -n 10
78-
86+ </code >
87+ <code >
7988[ ...]
8089org.apache.batik.dom.AbstractParentNode: appendChild org.apache.batik.dom.AbstractParentNode: fireDOMNodeInsertedEvent 6270
8190org.apache.batik.dom.AbstractParentNode: fireDOMNodeInsertedEvent org.apache.batik.dom.AbstractDocument: getEventsEnabled 6280
@@ -85,14 +94,14 @@ org.apache.batik.dom.util.DoublyIndexedTable:put org.apache.batik.dom.util.Doubl
8594org.apache.batik.dom.AbstractElement: invalidateElementsByTagName org.apache.batik.dom.AbstractElement: getNodeType 7198
8695org.apache.batik.dom.AbstractElement: invalidateElementsByTagName org.apache.batik.dom.AbstractDocument: getElementsByTagName 14396
8796org.apache.batik.dom.AbstractElement: invalidateElementsByTagName org.apache.batik.dom.AbstractDocument: getElementsByTagNameNS 28792
88-
8997</code >
9098
9199Running the lucene Dacapo benchmark:
92100
93101<code >
94102java -Xbootclasspath:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar: jar /lucene-core-2.4.jar: jar /luindex.jar -javaagent: target /javacg-0.1-SNAPSHOT-dycg-agent.jar="incl=org.apache.lucene.* ;" -jar dacapo-9.12-bach.jar luindex -s small |tail -n 10
95-
103+ </code >
104+ <code >
96105[ ...]
97106org.apache.lucene.analysis.Token: setTermBuffer org.apache.lucene.analysis.Token: growTermBuffer 43449
98107org.apache.lucene.analysis.CharArraySet: getSlot org.apache.lucene.analysis.CharArraySet: getHashCode 43472
@@ -107,8 +116,6 @@ org.apache.lucene.analysis.Token:termLength org.apache.lucene.analysis.Token:ini
107116
108117</code >
109118
110-
111-
112119#### Known Restrictions
113120
114121* The static call graph generator does not account for methods invoked via
@@ -121,3 +128,4 @@ Georgios Gousios <gousiosg@gmail.com>
121128#### License
122129
123130[ 2-clause BSD] ( http://www.opensource.org/licenses/bsd-license.php )
131+
0 commit comments