Skip to content

Using Soot and TamiFlex to analyze DaCapo

johspaeth edited this page Aug 27, 2014 · 12 revisions

1. Downloading the necessary components

To analyze DaCapo benchmarks with Soot, first download the following:

After downloading the JAR files, your setup should look roughly like follows:

$ls -1
dacapo-9.12-bach.jar
pia-x.y.z.jar
poa-x.y.z.jar
soot-2.5.0.jar

2. Dumping classes and creating log files

ext we use the Play-Out Agent to dump for each of the DaCapo benchmark configurations all class files that the JVM loads when executing this configuration and a reflection trace file that contains information about reflective calls.

Let us first consider a single run on dacapo, on avrora-small. Normally, we run avrora simply by stating java -jar dacapo-9.12-bach.jar avrora -s small. To activate the Play-Out Agent, we instead use the following command:

java -javaagent:poa-x.y.z.jar -jar dacapo-9.12-bach.jar avrora -s small
===== DaCapo 9.12 avrora starting =====
===== DaCapo 9.12 avrora PASSED in 5065 msec =====
=============================================
TamiFlex Play-Out Agent Version 1.0
Found 36 new log entries.

The part -javaagent:poa-x.y.z.jar instructs the VM to use the Play-Out Agent. Note the additional output Found 36 new entries.... The agent reports that it found 36 new entries for the reflection-log file.

You can inspect the log file (And dumped class files) if you want:

$ ls out
avrora  cck  Harness.class  java  org  refl.log  sun
$ head out//refl.log 
Class.forName;avrora.Main;org.dacapo.harness.Avrora.<init>;26;
Class.forName;java.security.MessageDigestSpi;java.security.Security.getSpiClass;640;
Class.forName;java.util.CurrencyData;java.util.Currency$1.run;128
...

As you can see, by default, the agent dumps its log file and class files into the out directory. The directory can be modified using a ConfigurationFile.

NOTE: The Play-Out Agent requires additional heap space. We therefore advise you to provide the JVM with additional space using the -Xmx flag.

For your convenience, we provide a script that allows you to dump class files and reflection traces for all dacapo benchmarks and all input sizes. (You will also need the settings script.) Those scripts will only work with TamiFlex versions smaller than 2.0.

2. Running soot

We next want to use Soot to analyze (and potentially transform) the dumped class files, constructing a call graph based on the information from the reflection trace file.

To apply Soot to avrora-small, we can use the following command:

java -Xmx10G -cp soot-2.5.0.jar soot.Main -w -app -p cg.spark enabled -p cg refelction-log:out/refl.log -cp JAVA_HOME/lib/rt.jar:JAVA_HOME/lib/jce.jar:out -include org.apache. -include org.w3c. -main-class Harness -d sootified/avrora-small Harness

TODO This command is not working? Ask

Clone this wiki locally