Skip to content

Commit bd61ce5

Browse files
committed
Update documentation
1 parent a6709b2 commit bd61ce5

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ A suite of programs for generating static and dynamic call graphs in Java.
1212

1313
#### Compile
1414

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:
1616

17-
<code>
17+
```
1818
mvn install
19-
</code>
19+
```
2020

2121
This will produce a `target` directory with the following three jars:
2222
- 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
3131

3232
`javacg-static` accepts as arguments the jars to analyze.
3333

34-
<code>
34+
```
3535
java -jar javacg-0.1-SNAPSHOT-static.jar lib1.jar lib2.jar...
36-
</code>
36+
```
3737

3838
`javacg-static` produces combined output in the following format:
3939

4040
###### For methods
4141

42-
<code>
43-
M:class1:<method1> (typeofcall)class2:<method2>
44-
</code>
42+
```
43+
M:class1:<method1>(arg_types) (typeofcall)class2:<method2>(arg_types)
44+
```
4545

4646
The line means that `method1` of `class1` called `method2` of `class2`.
4747
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):
5050

5151
* `M` for `invokevirtual` calls
5252
* `I` for `invokeinterface` calls
5353
* `O` for `invokespecial` calls
5454
* `S` for `invokestatic` calls
55+
* `D` for `invokedynamic` calls
56+
57+
For `invokedynamic` calls, it is not possible to infer the argument types.
5558

5659
###### For classes
5760

58-
<code>
61+
```
5962
C:class1 class2
60-
</code>
63+
```
6164

6265
This means that some method(s) in `class1` called some method(s) in `class2`.
6366

6467
##### Dynamic
6568

66-
`javacg-dynamic` uses
69+
`javacg-dynamic` uses
6770
[javassist](http://www.csg.is.titech.ac.jp/~chiba/javassist/) to insert probes
6871
at method entry and exit points. To be able to analyze a class `javassist` must
6972
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
8184
to be instrumented through include and exclude statements. The options are
8285
appended to the `-javaagent` argument and has the following format
8386

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+
```
8590

8691
The example above will instrument all classes under the the `mylib`, `mylib2` and
8792
`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
9095
java
9196
-Xbootclasspath:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:mylib.jar
9297
-javaagent:javacg-0.1-SNAPSHOT-dycg-agent.jar="incl=mylib.*;"
93-
-classpath mylib.jar mylib.Mainclass
98+
-classpath mylib.jar mylib.Mainclass
9499
```
95100

96101
`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:
110115

111116
The output line starts with a `<` or `>` depending on whether it is a method
112117
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`
114119
script processes the callgraph output to generate total time per method
115-
information.
120+
information.
116121

117122
#### Examples
118123

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.
121126
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,
123128
extract the `dacapo.jar` to a directory: all the required libraries can be found
124129
in the `jar` directory.
125130

@@ -167,7 +172,7 @@ org.apache.lucene.analysis.Token:termLength org.apache.lucene.analysis.Token:ini
167172

168173
* The static call graph generator does not account for methods invoked via
169174
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
171176
multithreaded programs
172177
* The dynamic call graph generator does not handle exceptions very well, so some
173178
methods might appear as having never returned
@@ -179,4 +184,3 @@ Georgios Gousios <gousiosg@gmail.com>
179184
#### License
180185

181186
[2-clause BSD](http://www.opensource.org/licenses/bsd-license.php)
182-

0 commit comments

Comments
 (0)