@@ -12,11 +12,11 @@ A suite of programs for generating static and dynamic call graphs in Java.
12
12
13
13
#### Compile
14
14
15
- The java-callgraph package is build with maven. Install maven and do:
15
+ The java-callgraph package is build with maven. Install maven and do:
16
16
17
- < code >
17
+ ```
18
18
mvn install
19
- </ code >
19
+ ```
20
20
21
21
This will produce a ` target ` directory with the following three jars:
22
22
- javacg-0.1-SNAPSHOT.jar: This is the standard maven packaged jar with static and dynamic call graph generator classes
@@ -31,39 +31,42 @@ Instructions for running the callgraph generators
31
31
32
32
` javacg-static ` accepts as arguments the jars to analyze.
33
33
34
- < code >
34
+ ```
35
35
java -jar javacg-0.1-SNAPSHOT-static.jar lib1.jar lib2.jar...
36
- </ code >
36
+ ```
37
37
38
38
` javacg-static ` produces combined output in the following format:
39
39
40
40
###### For methods
41
41
42
- < code >
43
- M:class1:<method1 > (typeofcall)class2:<method2 >
44
- </ code >
42
+ ```
43
+ M:class1:<method1>(arg_types) (typeofcall)class2:<method2>(arg_types)
44
+ ```
45
45
46
46
The line means that ` method1 ` of ` class1 ` called ` method2 ` of ` class2 ` .
47
47
The type of call can have one of the following values (refer to
48
- the [ JVM specification] ( http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc6.html )
49
- for the meaning of the calls):
48
+ the [ JVM specification] ( http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc6.html )
49
+ for the meaning of the calls):
50
50
51
51
* ` M ` for ` invokevirtual ` calls
52
52
* ` I ` for ` invokeinterface ` calls
53
53
* ` O ` for ` invokespecial ` calls
54
54
* ` S ` for ` invokestatic ` calls
55
+ * ` D ` for ` invokedynamic ` calls
56
+
57
+ For ` invokedynamic ` calls, it is not possible to infer the argument types.
55
58
56
59
###### For classes
57
60
58
- < code >
61
+ ```
59
62
C:class1 class2
60
- </ code >
63
+ ```
61
64
62
65
This means that some method(s) in ` class1 ` called some method(s) in ` class2 ` .
63
66
64
67
##### Dynamic
65
68
66
- ` javacg-dynamic ` uses
69
+ ` javacg-dynamic ` uses
67
70
[ javassist] ( http://www.csg.is.titech.ac.jp/~chiba/javassist/ ) to insert probes
68
71
at method entry and exit points. To be able to analyze a class ` javassist ` must
69
72
resolve all dependent classes at instrumentation time. To do so, it reads
@@ -81,7 +84,9 @@ entries), `javacg-dynamic` includes support for restricting the set of classes
81
84
to be instrumented through include and exclude statements. The options are
82
85
appended to the ` -javaagent ` argument and has the following format
83
86
84
- <code >-javaagent: javacg-dycg-agent .jar="incl=mylib.* ,mylib2.* ,java.nio.* ;excl=java.nio.charset.* "</code >
87
+ ```
88
+ -javaagent:javacg-dycg-agent.jar="incl=mylib.*,mylib2.*,java.nio.*;excl=java.nio.charset.*"
89
+ ```
85
90
86
91
The example above will instrument all classes under the the ` mylib ` , ` mylib2 ` and
87
92
` java.nio ` namespaces, except those that fall under the ` java.nio.charset ` namespace.
@@ -90,7 +95,7 @@ The example above will instrument all classes under the the `mylib`, `mylib2` an
90
95
java
91
96
-Xbootclasspath:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:mylib.jar
92
97
-javaagent:javacg-0.1-SNAPSHOT-dycg-agent.jar="incl=mylib.*;"
93
- -classpath mylib.jar mylib.Mainclass
98
+ -classpath mylib.jar mylib.Mainclass
94
99
```
95
100
96
101
` javacg-dynamic ` produces two kinds of output. On the standard output, it
@@ -110,16 +115,16 @@ a poor man's profiler. The format is the following:
110
115
111
116
The output line starts with a ` < ` or ` > ` depending on whether it is a method
112
117
entry or exit. It then writes the stack depth, thread id and the class and
113
- method name, followed by a timestamp. The provided ` process_trace.rb `
118
+ method name, followed by a timestamp. The provided ` process_trace.rb `
114
119
script processes the callgraph output to generate total time per method
115
- information.
120
+ information.
116
121
117
122
#### Examples
118
123
119
- The following examples instrument the
120
- [ Dacapo benchmark suite] ( http://dacapobench.org/ ) to produce dynamic call graphs.
124
+ The following examples instrument the
125
+ [ Dacapo benchmark suite] ( http://dacapobench.org/ ) to produce dynamic call graphs.
121
126
The Dacapo benchmarks come in a single big jar archive that contains all dependency
122
- libraries. To build the boot class path required for the javacg-dyn program,
127
+ libraries. To build the boot class path required for the javacg-dyn program,
123
128
extract the ` dacapo.jar ` to a directory: all the required libraries can be found
124
129
in the ` jar ` directory.
125
130
@@ -167,7 +172,7 @@ org.apache.lucene.analysis.Token:termLength org.apache.lucene.analysis.Token:ini
167
172
168
173
* The static call graph generator does not account for methods invoked via
169
174
reflection.
170
- * The dynamic call graph generator will not work reliably (or at all) for
175
+ * The dynamic call graph generator will not work reliably (or at all) for
171
176
multithreaded programs
172
177
* The dynamic call graph generator does not handle exceptions very well, so some
173
178
methods might appear as having never returned
@@ -179,4 +184,3 @@ Georgios Gousios <gousiosg@gmail.com>
179
184
#### License
180
185
181
186
[ 2-clause BSD] ( http://www.opensource.org/licenses/bsd-license.php )
182
-
0 commit comments