CodeSleuth, a new performance analysis utility for Java applications running on Windows®, can help you see how efficiently your applications are running. If you write Java applications on Windows, and you use the Eclipse toolchain, you should try out CodeSleuth. And guess what? It's free of charge, it's open source, and it is designed to work with software running on AMD and Intel microprocessors.
The open source project's SourceForge home page describes CodeSleuth aptly: It's an open-source "Eclipse plugin that allows developers to access performance counters [embedded with the processor] and relate them back to Java source."
CodeSleuth helps developers understand how their software applications are performing from a microprocessor perspective. It provides deeper information about bottlenecks that can be addressed to help improve performance by providing insight into how code is being processed by the hardware.
Modern microprocessors include in their instruction sets not only the usual copies, adds, compares, and other traditional assembly-language constructs that higher-level languages most often use, but also, among other "meta-programming instructions," performance counters. Performance counters measure and manage "performance-relevant events of the microprocessor without affecting the performance of a program," in the helpful words of The Performance Counter Library Home Page.
CodeSleuth brings the functionality of the AMD CodeAnalyst™ Performance Analyzer for Java programs into an environment that many Java developers are already familiar with - Eclipse.
AMD CodeAnalyst for Windows is a suite of performance tools, available at no charge with license, that apply to a range of x86 models. AMD CodeAnalyst works great on single-core and multicore processors of all stripes, including the latest from AMD and Intel lines. CodeSleuth is designed to provide a bridge between your Eclipse-based IDE and AMD CodeAnalyst, so that you may be able to do all your performance work from within the IDE.
Using CodeSleuth, you can drill down to system-level performance that you won't find with hprof-based testing, such as monitoring cache behavior, pipeline blocks, locality of thread-specific memory access, and similar measurements.
CodeSleuth's SourceForge page puts it this way: "This tool enables you to track counter information from raw address locations, through the machine code emitted by Java Virtual Machines (JVMs), and back to the Java source. Once you identify the location of performance issues in the Java source, you can modify the code to improve application performance."
CodeSleuth supports a number of different measurement techniques: sophisticated event-based profiling based on hardware performance events, call stack sampling and timer-based profiling, and more.
It doesn't take long to start your own analysis with CodeSleuth. If you're a Java programmer on Windows already using Eclipse Europa 3.3 or later, you probably have Sun's JDK 1.6 or later. If so, your next step is to register with AMD (no cost), and retrieve CodeAnalyst 2.76 or later (about 32 megabytes). Finally, from inside Eclipse,
-
Select "Help/Software Updates/Find And Install;"
-
Select "Search for new features to install;"
-
Select "New Remote Site" in the resulting wizard;
-
Create a new update site using the URL http://developer.amd.com/codesleuth_1_0_0; and
-
Have the wizard finish installation of the plugin (25 megabytes).
Installation from source is feasible, but far less convenient. My recommendation: only turn to source installation if you have unusual customization or license requirements.
Once CodeSleuth is installed, its documentation becomes available through Eclipse's familiar Help/Help Contents/CodeSleuth User Guide selection.
To begin using CodeSleuth, first create a CodeSleuth run configuration. As the CodeSleuth User Guide explains, do this from within Eclipse by selecting the Run/Open Run Dialog. In the Run dialog, right-click on CodeSleuth, and select New. With a simple Run Dialog created, running the project from that Run Dialog writes a binary results file of the form <timestamp>.ca. Single-click selection of any of these results files immediately populates CodeSleuth report tabs. Notice that the .ca suffix comes from "CodeAnalyst."
It's important to make sure that the CodeSleuth views are enabled in your Eclipse IDE, otherwise you'll find that clicking on the .ca results file won't do much. Most developers will find the 'navigation' view to be sufficient. There's another view for disassembled code, but unless you really want to see what the JIT (just-in-time) compiler is doing, you probably won't need to use this.
What's particularly exciting here is that if you click on results data in the navigation view (or the disassembled view), your Eclipse-based IDE will jump right to the appropriate line in the source code. That's what the CodeSleuth plugin is all about, leveraging the power of Eclipse to make coding and testing one seamless experience.
CodeSleuth has several distinctions you should know to make the best of it. While there's no traditional mailing list, the AMD Developer Central developer forums , which mostly focuses on AMD software, is responsive and accurate on CodeSleuth questions.
Bear in mind that CodeSleuth profiles source compiled within its instrumented JVM. Code uncompiled from the perspective of the JVM, whether because the compiler "inlines" it, or because it's so lightweight the compiler doesn't bother with its JIT compilation, shows up as taking 0.0% of all time. "Hello, World" for CodeSleuth involves quite a lot more than just
System.out.println("Hello World!");
because any meaningful example depends on the JITing of the JVM. Note, also, that CodeSleuth use involves two concurrent JVMs on the host: one for Eclipse, and a separate one for the application under study.
In my opinion, CodeSleuth just works. That's the highest praise: meaningful and illuminating measurement of an existing or new Java project is only a few downloads and configuration clicks away for those who use Eclipse.
More precisely, CodeSleuth just works in the right circumstances. I find that it's indispensable for thorny problems specific to the kinds of pipelining typical of modern CPUs, making it a great complement to functional testing tools like JUnit. In the instances where Java code itself presents a meaningful bottleneck, however, CodeSleuth does a great job of relating slowdowns on the chip through the JVM to the corresponding Java source.
CodeSleuth has the potential to explode into widespread use, because it integrates so well with Eclipse, and because it is designed to work with all Windows Java apps running on AMD and Intel processors. Being free of charge and open source, even programmers who don't need it immediately can easily experiment with it. Once that happens, they'll be in a position to see applications for CodeSleuth beyond strict requirements.
That's a prescription for a technology that can take off in a "virtuous cycle:" easy to use, broadly applicable, and rewarding of experience and understanding. Find out for yourself by downloading and trying CodeSleuth today. If you're already using CodeSleuth, the team would love to have your feedback and suggestions.
|