The following third-party analysis tools are not part of the normal development cycle, but are useful in helping to identify bugs and weaknesses in the source code.
Clover is a proprietary test coverage tool. After setting the environment variable
CLOVER_JAR to point to your installation, you can use
ant clover to generate a report.
On the Rice Computer Science department network,
CLOVER_JAR should point to
The YourKit Java Profiler is a powerful proprietary profiler for Java programs that has been lincensed to the DrJava open source project free of charge. It may only be used for developing and improving DrJava and individual licenses for each individual developer are required; they also need to be renewed from time to time. All of this has been generally unproblematic by emailing firstname.lastname@example.org. Please do not jeopardize our very good relationshit with YourKit by using it in ways not approved.
Getting YourKit. You can download YourKit from the URL above, but have also installed YourKit into
the javaplt account on CSnet. Here are instructions if you want to use it. Please note that this
is for the Linux environment on CSnet. For Windows and MacOS, or away from CSnet, these steps
Location of YourKit on CSnet. YourKit is located in the directory
/home/javaplt/packages/yjp-6.0.11 . You
should add the
bin path to your
variable. Make the following directory accessible from everywhere:
That gives you access to the two most important scripts,
Adding the Library. Before you can use Yourkit, you have to set the following environment variable:
export LD_LIBRARY_PATH="/home/javaplt/packages/yjp-6.0.11/bin/linux-x86-32" .
If you already have an
LD_LIBRARY_PATH variable, then you
should extend it by adding a colon and the path:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/javaplt/packages/yjp-6.0.11/bin/linux-x86-32" .
Starting YourKit. To start YourKit, run the following script from the command line:
yjp.sh & .
& at the end will make YourKit run in the background, i.e. you can
still use the same command line window you've been using.
The first time you start YourKit, it should ask you for your license
information. If you are a member of the core DrJava development team, you
should have by now received your personalized license key.
Starting the Application to Profile. You need to pass a special command line argument to your java
executable when you're running a program that you want to profile:
To make that easier to remember, I have written a script that passes
that arguments, and all the argument passed to the script, to java.
It's located in the same directory as Yourkit:
If you added YourKit to your path in step 2, it should be directly
If you want to use it to run a program that you would normally start
java MyClass .
now just use:
yjpjava MyClass .
Here is a more complicated example to start DrJava. Instead of
java -cp drjava-15.jar edu.rice.cs.drjava.DrJava .
now write the following, which avoids the restart, which
may cause trouble:
yjpjava -cp drjava-15.jar edu.rice.cs.drjava.DrJavaRoot .
For this to work, you have to make sure that you have the
file on your Java
CLASSPATH environment variable.
Regardless, the application you just started should launch now.
Starting to Profile. When you actually want to record usage times and counts, press the
"Start CPU Profiling" button. That will open another pane. There are
two selections, "Sampling" and "Tracing", and as far as I know,
"Sampling" records times only and doesn't give you invocation counts
and call stacks, but is faster. "Tracing" is a lot slower but gives
you more information.
Viewing Data. When you want to view the data, i.e. when you're done performing
the action you want to profile, press the "Capture Snapshot" button.
That will bring up a dialog that tells you the file name as which the
snapshot has been saved, and it asks you whether you want to open the
snapshot. You probably want to press "Open" if you want to look at the
data right now.
Taking a Snapshot Stops Profiling. Note that taking a snapshot stops profiling, so if you want to
continue to profile, you need to press the "Start CPU Profiling"
Sorting Methods. On the page that displays CPU snapshot informations, there are lots
of ways to gather information. I haven't explored everything. I found
selecting "Method List" on the left the most useful. That will give
you a lsit of all methods that were called, and you can sort by name,
time, own time, and invocation count (if you used tracing). Time
includes time spent in calls to other methods, i.e. the time from
method entry to method exit. Own time is only the time spent in the
actual method, i.e. the time from method entry to method exit
EXCLUDING the time spent in other methods that were called.
Finding the Hotspot. Usually I found a very sharp break between the times, i.e. going from
40 seconds in some methods (that were probably in a call chain) to 5
seconds. My intuition tells me that the last method to have a lot of
time spent is one of the "hot spots". You should also look at the
invocation count: The program may spend a lot of time in a method, but
if it's called very often, that may not mean very much.
FindBugs is an open-source static analysis tool that tries to identify Java bugs. After setting the environment variable
FINDBUGS_HOME to point to your installation, you can use
ant findbugs to generate a summary of possible bugs.
On the Rice Computer Science department network,
FINDBUGS_HOME should point to
If necessary, the
findbugs-excludes property in the Ant script can be edited to filter out unwanted warnings.